Files
piratepoet/mailpoet/tasks/phpstan/phpstan.neon
2024-01-22 14:48:00 +01:00

127 lines
6.3 KiB
Plaintext

parameters:
level: 9
tmpDir: ../../temp/phpstan
bootstrapFiles:
- ../../vendor/autoload.php
- bootstrap.php
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- vendor/php-stubs/woocommerce-stubs/woocommerce-packages-stubs.php
- ../../vendor/codeception/codeception/autoload.php
- ../../vendor/codeception/verify/src/Codeception/Verify/Verify.php
- ../../tests/_support/_generated/AcceptanceTesterActions.php
- ../../tests/_support/_generated/IntegrationTesterActions.php
- ../../tests/_support/_generated/UnitTesterActions.php
scanDirectories:
- ../../tests/_support
- ../../tests/acceptance
- ../../tests/integration
- ../../tests/unit
scanFiles:
- PremiumContainerConfigurator.php
- ../../vendor-prefixed/twig/twig/src/Extension/CoreExtension.php # phpstan can't find \MailPoetVendor\twig_include function
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- custom-stubs.php
inferPrivatePropertyTypeFromConstructor: true
checkGenericClassInNonGenericObjectType: false
parallel:
processTimeout: 300.0
maximumNumberOfProcesses: 3 # Static analysis is running on Circle CI medium+ that has 3 CPUs
ignoreErrors:
- '#Function members_register_.+ not found#'
- '#Argument of an invalid type MailPoetVendor\\pQuery\\IQuery supplied for foreach, only iterables are supported#'
# exclude level 6 errors (but keep them for Automation)
- '/(Method|Property|Function) (?!MailPoet\\Automation\\).*has no (return )?type specified/'
- '/(Method|Function) (?!MailPoet\\Automation\\).*has parameter (\$[_A-Z]{1}[_a-z]+)? with no type (specified)?/i'
- # Primary keys ScheduledTaskSubscriberEntity of are foreign keys and foreign keys may be null because of missing related record
message: '#Property MailPoet\\Entities\\[a-zA-Z]+::\$[a-z]+ type mapping mismatch: property can contain MailPoet\\Entities\\[a-zA-Z]+\|null but database expects MailPoet\\Entities\\[a-zA-Z]+.#'
path: ../../lib/Entities/ScheduledTaskSubscriberEntity.php
count: 2
- '/Parameter #1 \$cssOrXPath of method AcceptanceTester::moveMouseOver\(\) expects string\|null, array<string, string> given./'
- '/Call to method getName\(\) on an unknown class _generated\\([a-zA-Z])*Cookie/' # codeception generate incorrect return type in ../../tests/_support/_generated
-
message: "#^Cannot cast string|void to string\\.$#"
count: 11
path: ../../lib/Automation/Engine/Storage/AutomationRunStorage.php
-
message: "#^Cannot cast string|void to string\\.$#"
count: 12
path: ../../lib/Automation/Engine/Storage/AutomationStorage.php
-
message: '/^Call to static method get_orders_table_name\(\) on an unknown class Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore\.$/'
count: 1
path: ../../lib/WooCommerce/Helper.php
-
message: '/^Call to static method get_addresses_table_name\(\) on an unknown class Automattic\\WooCommerce\\Internal\\DataStores\\Orders\\OrdersTableDataStore\.$/'
count: 1
path: ../../lib/WooCommerce/Helper.php
-
message: '/^Call to function method_exists\(\) with/'
count: 2
path: ../../lib/WooCommerce/Helper.php
-
message: '/^Cannot call method get\(\) on mixed.$/'
count: 2
path: ../../lib/PostEditorBlocks/WooCommerceBlocksIntegration.php
-
message: '/^Call to an undefined method Codeception\\TestInterface::getName()./'
count: 1
path: ../../tests/_support/CheckSkippedTestsExtension.php
- message: '/Parameter \$record of method MailPoet\\Logging\\PluginVersionProcessor::__invoke\(\) has invalid type MailPoetVendor\\Monolog\\Processor\\Record/'
count: 1
path: ../../lib/Logging/PluginVersionProcessor.php
- message: '/Return type \(array\) of method MailPoet\\Logging\\PluginVersionProcessor::__invoke\(\) should be compatible with return type \(MailPoetVendor\\Monolog\\Processor\\Record\) of method MailPoetVendor\\Monolog\\Processor\\ProcessorInterface::__invoke\(\)/'
count: 1
path: ../../lib/Logging/PluginVersionProcessor.php
-
message: "#^Cannot cast string|void to string\\.$#"
count: 3
path: ../../lib/Automation/Integrations/WooCommerce/Fields/CustomerOrderFieldsFactory.php
-
message: "#^Cannot cast string|void to string\\.$#"
count: 2
path: ../../lib/Automation/Integrations/WooCommerce/Fields/CustomerReviewFieldsFactory.php
-
message: "#^Cannot cast string|void to string\\.$#"
count: 1
path: ../../lib/Automation/Integrations/WooCommerce/Fields/TermParentsLoader.php
-
# WP annotates parameter as callable, but passes empty string as a default.
message: '/function add_(sub)?menu_page expects callable\(\): mixed, ''''\|\(callable\(\): mixed\) given/'
count: 2
path: ../../lib/WP/Functions.php
-
# We don't allow seting properties for read-only entity WpPostEntity
message: '#^Property MailPoet\\Entities\\WpPostEntity::\$postTitle is never written, only read\.$#'
count: 1
path: ../../lib/Entities/WpPostEntity.php
reportUnmatchedIgnoredErrors: true
dynamicConstantNames:
- MAILPOET_PREMIUM_INITIALIZED
- MAILPOET_PREMIUM_VERSION
doctrine:
objectManagerLoader: create-entity-manager.php
# exclude level 6 errors
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false # We have some incorrect phpdoc types, but I want to address them later
excludePaths:
analyseAndScan:
- ../../lib/Config/PopulatorData/Templates # analysis of templates is extremely slow, let's skip them for now
- ../../lib/Models # Old models are deprecated and will be removed soon
- ../../tests/_support/_generated
- ../../tests/integration/Models # Old models are deprecated and will be removed soon
- ../../tests/unit/Entities/SubscriberEntityTest.php
- ../../tests/unit/_stubs.php # Contains stubs for WP classes etc.
- 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-doctrine/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-doctrine/rules.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon
- phpstan-baseline-fix-lib.php # include baseline files