Skip to content

Warn about misconfiguration #29

@Stadly

Description

@Stadly

It would be easier to configure PHPStan exception rules correctly if warnings were emitted for potential misconfigurantions. Consider the following configuration file:

parameters:
    exceptionRules:
        checkedExceptions: # or uncheckedExceptions
            - FooException
        methodThrowTypeDeclarations:
            Bar:
                barMethod:
                    - BarException
        functionThrowTypeDeclarations:
            bazFunction:
                - BazException

includes:
    - vendor/pepakriz/phpstan-exception-rules/extension.neon

A warning should be shown when

  • FooException does not exist.
  • FooException does not implement Throwable.
  • Bar does not exist.
  • Bar::barMethod does not exist.
  • BarException does not exist.
  • BarException does not implement Throwable.
  • bazFunction does not exist.
  • BazException does not exist.
  • BazException does not implement Throwable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions