Use email editor custom config for phpstan

MAILPOET-6318
This commit is contained in:
Oluwaseun Olorunsola
2024-11-20 17:47:28 +01:00
committed by Jan Lysý
parent 9102ec9735
commit 40aac9e65c
2 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
parameters:
level: 9
tmpDir: ../../temp/phpstan
bootstrapFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
inferPrivatePropertyTypeFromConstructor: true
checkGenericClassInNonGenericObjectType: false
parallel:
processTimeout: 300.0
maximumNumberOfProcesses: 3 # Static analysis is running on Circle CI medium+ that has 3 CPUs
reportUnmatchedIgnoredErrors: true
dynamicConstantNames:
- MAILPOET_PREMIUM_INITIALIZED
- MAILPOET_PREMIUM_VERSION
# exclude level 6 errors
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false # We have some incorrect phpdoc types, but I want to address them later
excludePaths:
analyseAndScan:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php # does not yet offer support for PHP 8.1
includes:
- extensions/CodeceptionExtension/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon

View File

@@ -14,6 +14,8 @@ $emailEditorPhpDir = dirname( __DIR__, 1 );
$phpStanDir = "$mailpoetRootDir/mailpoet/tasks/phpstan"; $phpStanDir = "$mailpoetRootDir/mailpoet/tasks/phpstan";
$phpStanBin = "$phpStanDir/vendor/bin/phpstan"; $phpStanBin = "$phpStanDir/vendor/bin/phpstan";
$emailEditorCustomConfig = "$phpStanDir/email-editor-phpstan.neon";
$extraAgrPhpVersion = ''; $extraAgrPhpVersion = '';
if ( $argc > 1 && isset( $argv[1] ) && stripos( $argv[1], 'php-version' ) !== false ) { if ( $argc > 1 && isset( $argv[1] ) && stripos( $argv[1], 'php-version' ) !== false ) {
@@ -27,9 +29,10 @@ $commands = array(
"$extraAgrPhpVersion", "$extraAgrPhpVersion",
'php -d memory_limit=-1 ', 'php -d memory_limit=-1 ',
"$phpStanBin analyse ", "$phpStanBin analyse ",
"-c $emailEditorCustomConfig ",
"$emailEditorPhpDir/src ", "$emailEditorPhpDir/src ",
"$emailEditorPhpDir/tests/integration ", // "$emailEditorPhpDir/tests/integration ", // TODO: will uncomment after fixing src errors
"$emailEditorPhpDir/tests/unit ", // "$emailEditorPhpDir/tests/unit ", // TODO: will uncomment after fixing tests/integration errors
); );
$allCommands = implode( ' ', $commands ); $allCommands = implode( ' ', $commands );