Added phpstan-symfony plugin to improve inspections on getArgument and getOption

This commit is contained in:
Alejandro Celaya 2021-07-19 19:59:41 +02:00
parent b8fa234dbb
commit 934d266880
7 changed files with 27 additions and 9 deletions

View file

@ -3,5 +3,8 @@
declare(strict_types=1); declare(strict_types=1);
$run = require __DIR__ . '/../config/run.php'; use Symfony\Component\Console\Application;
$run(true);
/** @var Application $app */
$app = require __DIR__ . '/../config/cli-app.php';
$app->run();

View file

@ -66,7 +66,8 @@
"eaglewu/swoole-ide-helper": "dev-master", "eaglewu/swoole-ide-helper": "dev-master",
"infection/infection": "^0.21.0", "infection/infection": "^0.21.0",
"phpspec/prophecy-phpunit": "^2.0", "phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12.64", "phpstan/phpstan": "^0.12.92",
"phpstan/phpstan-symfony": "^0.12.41",
"phpunit/php-code-coverage": "^9.2", "phpunit/php-code-coverage": "^9.2",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",

12
config/cli-app.php Normal file
View file

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application as CliApp;
return (static function () {
/** @var ContainerInterface $container */
$container = include __DIR__ . '/container.php';
return $container->get(CliApp::class);
})();

View file

@ -6,7 +6,7 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner; use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
return (function () { return (static function () {
/** @var ContainerInterface $container */ /** @var ContainerInterface $container */
$container = include __DIR__ . '/container.php'; $container = include __DIR__ . '/container.php';
$em = $container->get(EntityManager::class); $em = $container->get(EntityManager::class);

View file

@ -4,12 +4,11 @@ declare(strict_types=1);
use Mezzio\Application; use Mezzio\Application;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Application as CliApp;
return function (bool $isCli = false): void { return static function (): void {
/** @var ContainerInterface $container */ /** @var ContainerInterface $container */
$container = include __DIR__ . '/container.php'; $container = include __DIR__ . '/container.php';
$app = $container->get($isCli ? CliApp::class : Application::class); $app = $container->get(Application::class);
$app->run(); $app->run();
}; };

View file

@ -1,5 +1,9 @@
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
parameters: parameters:
checkMissingIterableValueType: false checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false checkGenericClassInNonGenericObjectType: false
ignoreErrors: ignoreErrors:
- '#If condition is always false#' - '#If condition is always false#'
symfony:
console_application_loader: 'config/cli-app.php'

View file

@ -2,5 +2,4 @@
declare(strict_types=1); declare(strict_types=1);
$run = require __DIR__ . '/../config/run.php'; (require __DIR__ . '/../config/run.php')();
$run();