diff --git a/composer.json b/composer.json index 2269d9a..f132544 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "require": { "php": "^7.2 || ^8.0", "ext-simplexml": "*", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.11.7" }, "conflict": { "symfony/framework-bundle": "<3.0" diff --git a/extension.neon b/extension.neon index 1eb888a..e58d668 100644 --- a/extension.neon +++ b/extension.neon @@ -322,6 +322,10 @@ services: class: PHPStan\Symfony\PasswordAuthenticatedUserStubFilesExtension tags: - phpstan.stubFilesExtension + - + class: PHPStan\Symfony\SymfonyDiagnoseExtension + tags: + - phpstan.diagnoseExtension # FormInterface::getErrors() return type - diff --git a/src/Symfony/ConsoleApplicationResolver.php b/src/Symfony/ConsoleApplicationResolver.php index 51bd796..52f5f4f 100644 --- a/src/Symfony/ConsoleApplicationResolver.php +++ b/src/Symfony/ConsoleApplicationResolver.php @@ -27,6 +27,11 @@ public function __construct(Configuration $configuration) $this->consoleApplicationLoader = $configuration->getConsoleApplicationLoader(); } + public function hasConsoleApplicationLoader(): bool + { + return $this->consoleApplicationLoader !== null; + } + private function getConsoleApplication(): ?Application { if ($this->consoleApplicationLoader === null) { diff --git a/src/Symfony/SymfonyDiagnoseExtension.php b/src/Symfony/SymfonyDiagnoseExtension.php new file mode 100644 index 0000000..afd566d --- /dev/null +++ b/src/Symfony/SymfonyDiagnoseExtension.php @@ -0,0 +1,29 @@ +consoleApplicationResolver = $consoleApplicationResolver; + } + + public function print(Output $output): void + { + $output->writeLineFormatted(sprintf( + 'Symfony\'s consoleApplicationLoader: %s', + $this->consoleApplicationResolver->hasConsoleApplicationLoader() ? 'In use' : 'No' + )); + $output->writeLineFormatted(''); + } + +}