Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 703 Bytes

File metadata and controls

22 lines (16 loc) · 703 Bytes

Forbidden Namespaces Rule

Enforces that certain namespaces cannot be declared in your codebase. This rule checks the namespace keyword and prevents the declaration of namespaces matching specified regex patterns, helping to enforce architectural constraints.

Configuration Example

    -
        class: Phauthentic\PHPStanRules\Architecture\ForbiddenNamespacesRule
        arguments:
            forbiddenNamespaces: [
                '/^App\\Legacy\\.*/',
                '/^App\\Deprecated\\.*/'
            ]
        tags:
            - phpstan.rules.rule

Parameters

  • forbiddenNamespaces: Array of regex patterns matching namespaces that are not allowed to be declared.