Enterprise edition
PHPStan — Deep Reference
At a glance
Section titled “At a glance”- One public class:
EditionBoundaryRule, a custom PHPStan rule overusestatements. - Enforces the one-directional edition dependency order. Core never imports Pro or Enterprise. Pro never imports Enterprise.
- Violations report the identifier
nextpdf.editionBoundaryViolationon the offendinguseline. - Build-time only. The rule has no runtime path and no effect on generated PDFs.
- Ships in
nextpdf/enterprise. Registration uses standard PHPStan configuration.
Availability & licensing
Section titled “Availability & licensing”This capability ships in NextPDF Enterprise (nextpdf/enterprise) and activates with an Enterprise-tier license envelope. It is a build-time static-analysis rule with no runtime path: the nextpdf/enterprise package boundary gates it, and it carries no separate per-feature capability code. Core and Pro do not ship an equivalent. Compare editions and get a license.
Public API surface
Section titled “Public API surface”Install the package, then register the rule in PHPStan configuration.
composer require nextpdf/enterprise:^3rules: - NextPDF\Enterprise\PHPStan\EditionBoundaryRule| Symbol | Parameters | Default behavior | Returns | Throws or fails with | Notes |
|---|---|---|---|---|---|
EditionBoundaryRule | None (no constructor arguments) | Stateless PHPStan rule subscribed to use statements | — | Never throws | final; implements PHPStan\Rules\Rule over Use_ |
EditionBoundaryRule::getNodeType() | None | Declares the AST node type the rule subscribes to | string (Use_::class) | Never throws | Standard PHPStan Rule contract method |
EditionBoundaryRule::processNode() | Node $node, Scope $scope | Checks each imported symbol against the prefixes forbidden for the analyzed namespace | list<IdentifierRuleError> (empty when compliant) | Never throws; violations surface as rule errors | Error identifier nextpdf.editionBoundaryViolation |
final class EditionBoundaryRule implements Rule{ public function getNodeType(): string;
public function processNode(Node $node, Scope $scope): array;}Behavior contract
Section titled “Behavior contract”EditionBoundaryRule implements the standard PHPStan Rule contract over the Use_ node type. For each use statement it compares the analyzed file’s namespace against every imported symbol’s namespace prefix and enforces a one-directional dependency order.
| Analyzed namespace | Edition label | Forbidden import prefixes |
|---|---|---|
NextPDF\* sub-namespaces, excluding Pro and Enterprise | Core | NextPDF\Pro\, NextPDF\Enterprise\ |
NextPDF\Pro and NextPDF\Pro\* | Pro | NextPDF\Enterprise\ |
NextPDF\Enterprise and NextPDF\Enterprise\* | Enterprise | None (top tier) |
Any namespace outside NextPDF\ | — | None (unconstrained) |
When an import crosses the boundary, the rule reports an error under the identifier nextpdf.editionBoundaryViolation, anchored to the offending use statement line. The message names the imported symbol, the importing namespace, the forbidden prefix, and human-readable edition labels. Each imported symbol produces at most one error: prefix matching stops at the first forbidden prefix that matches.
The check is static and advisory. It reports boundary violations on import statements. It does not prove the analyzed program is otherwise correct.
Edge cases & failure modes
Section titled “Edge cases & failure modes”- Namespaces outside
NextPDF\and namespaceless files produce no errors; the rule returns an empty list. - Code declared in the exact root namespace
NextPDF(no sub-namespace segment) is not constrained; boundary detection matchesNextPDF\sub-namespaces. - Enterprise files are never flagged for importing Pro or Core symbols (top tier, by design).
- Prefix matching is separator-aware. A namespace such as
NextPDF\Professionalclassifies as Core, not Pro, and imports under it never false-positive against theNextPDF\Pro\prefix. - Importing the literal names
NextPDF\ProorNextPDF\Enterprisewith no further segment is not flagged; only symbols under those prefixes match. - The rule does not filter by import kind: class,
function, andconstimports under a forbidden prefix all report. - Inline fully-qualified references written without a
usestatement are out of scope. Prefer imports so the boundary is enforced. - Group
usedeclarations parse as the distinctGroupUsenode type and fall outside the rule’sUse_subscription; plain per-symbol imports keep the boundary checked. processNode()never throws; all outcomes surface as PHPStan rule errors or an empty result.- Not a runtime component. It performs no cryptographic operations, and FIPS mode is not applicable.
Conformance
Section titled “Conformance”No standards conformance is claimed. This is a developer-tooling rule that enforces an internal architectural constraint (edition layering) in downstream builds. It implements the PHPStan rule extension contract, which is a third-party tool API, not a formal standard. The rule makes no compliance, certification, or correctness guarantee about analyzed code; it reports edition-boundary import violations only and is advisory.
Development notes
Section titled “Development notes”- The rule executes inside PHPStan during analysis, reads source structure only, and has no effect on generated PDFs or any deployed service.
- Registering the rule and choosing the PHPStan level remain the integrator’s responsibility.
- The class is
finaland stateless, so it is safe under PHPStan’s parallel analysis workers. - Analysis output is deterministic for a given source tree: the same inputs yield the same error list.
- Available since
nextpdf/enterprise2.1.0; the contract above reflects 3.1.0.
Publication boundary
Section titled “Publication boundary”This page documents externally observable behavior and the supported public API surface only. Internal namespace paths, helper classes, mechanism tables, runbook filenames, and ticket prefixes are out of scope.