# PHPStan configuration of the plugin, modeled on Mautic core's phpstan.neon. # # The analysis needs the autoloader of a Mautic installation: the bootstrap file # (Tests/bootstrap.php) walks up from the plugin directory until it finds # vendor/autoload.php. Run it either from a Mautic installation that has this # plugin in docroot/plugins/, or after a `composer install` in the plugin # directory (which pulls mautic/core-lib and the require-dev tools): # # vendor/bin/phpstan analyse --no-progress -c phpstan.neon includes: # The documented debt found when the tooling was introduced (see readme.md, Coding # standards): Doctrine-assigned entity ids, historical migrations referencing the # pre-rename entity classes, and core's generic AbstractCommonModel::getRepository() # annotations. New errors still fail the analysis; regenerate the baseline after # fixing entries with `phpstan analyse --generate-baseline -c phpstan.neon`. - phpstan-baseline.neon parameters: level: 6 reportUnmatchedIgnoredErrors: false treatPhpDocTypesAsCertain: false paths: - Catalog - Command - Config - Controller - DependencyInjection - Entity - Event - EventListener - Form - Integration - Migrations - Model - Security - Service - Tests - Twig - Validator - MT3SMarketingProgramBundle.php excludePaths: - Resources - Translations - Assets # The same pragmatic ignores Mautic core keeps in its own phpstan.neon. ignoreErrors: - identifier: missingType.generics # not all IDEs are as smart as PHPSTAN and need the type hint - identifier: function.alreadyNarrowedType - identifier: instanceof.alwaysTrue - '/Variable \$\w+ might not be defined\./' # test mocks - '#Parameter (.*?) class (.*?) expects (.*?)PHPUnit\\Framework\\MockObject\\MockObject given#' - '#is not subtype of native type PHPUnit\\Framework\\MockObject\\MockObject#' - '#Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject#' - '#expects (.*?) PHPUnit\\Framework\\MockObject\\MockObject given#' bootstrapFiles: - Tests/bootstrap.php