diff --git a/src/DependencyInjection/PHPStanServicesFactory.php b/src/DependencyInjection/PHPStanServicesFactory.php index 4ebcc759d..f826803dd 100644 --- a/src/DependencyInjection/PHPStanServicesFactory.php +++ b/src/DependencyInjection/PHPStanServicesFactory.php @@ -71,12 +71,8 @@ public function __construct() } } - $additionalConfigFiles[] = $currentWorkingDirectory . '/vendor/rector/rector/packages/node-type-resolver/config/phpstan/type-extensions.neon'; $additionalConfigFiles[] = __DIR__ . '/../../utils/phpstan/config/extension.neon'; - // enable type inferring from constructor - $additionalConfigFiles[] = $currentWorkingDirectory . '/vendor/rector/rector/packages/node-type-resolver/config/phpstan/better-infer.neon'; - $this->container = $containerFactory->create(sys_get_temp_dir(), $additionalConfigFiles, []); // clear bleeding edge fallback diff --git a/src/HttpKernel/Typo3RectorKernel.php b/src/HttpKernel/Typo3RectorKernel.php index 27a20857a..12e1d248e 100644 --- a/src/HttpKernel/Typo3RectorKernel.php +++ b/src/HttpKernel/Typo3RectorKernel.php @@ -58,12 +58,12 @@ public function getLogDir(): string public function registerContainerConfiguration(LoaderInterface $loader): void { - $rectorConfigs = [ + $possibleRectorConfigPaths = [ __DIR__ . '/../../vendor/rector/rector/config/config.php', __DIR__ . '/../../../../rector/rector/config/config.php', ]; - foreach ($rectorConfigs as $rectorConfig) { + foreach ($possibleRectorConfigPaths as $rectorConfig) { if (file_exists($rectorConfig)) { $loader->load($rectorConfig); } diff --git a/utils/phpstan/config/extension.neon b/utils/phpstan/config/extension.neon index ddea1c47c..105641c01 100644 --- a/utils/phpstan/config/extension.neon +++ b/utils/phpstan/config/extension.neon @@ -1,13 +1,21 @@ +parameters: + inferPrivatePropertyTypeFromConstructor: true services: + - + class: Rector\NodeTypeResolver\PHPStan\TypeExtension\StaticContainerGetDynamicMethodReturnTypeExtension + tags: [phpstan.broker.dynamicMethodReturnTypeExtension] + - + class: Rector\NodeTypeResolver\PHPStan\TypeExtension\KernelGetContainerAfterBootReturnTypeExtension + tags: [phpstan.broker.dynamicMethodReturnTypeExtension] + - + class: Rector\Core\PHPStan\Type\ComponentModelDynamicReturnTypeExtension + tags: [phpstan.broker.dynamicMethodReturnTypeExtension] - class: Ssch\TYPO3Rector\PHPStan\Type\GeneralUtilityDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension + tags: [phpstan.broker.dynamicStaticMethodReturnTypeExtension] - class: Ssch\TYPO3Rector\PHPStan\Type\ObjectManagerDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension + tags: [phpstan.broker.dynamicMethodReturnTypeExtension] - class: Ssch\TYPO3Rector\PHPStan\Type\ContextGetAspectDynamicReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension + tags: [phpstan.broker.dynamicMethodReturnTypeExtension]