From d41d8b597505d8fe6e0afe7b56cee3665c76bb8d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 24 Jun 2026 15:00:43 +0200 Subject: [PATCH] Fix GitHub CI --- .github/workflows/static.yml | 2 +- .gitignore | 2 ++ .php_cs => .php-cs-fixer.dist.php | 6 +++--- phpstan.neon.dist | 4 ---- src/Application.php | 4 ++-- src/Command/CacheClearCommand.php | 4 ++-- src/Command/CheckDocsCommand.php | 4 ++-- src/Kernel.php | 2 +- src/Service/Baseline.php | 6 +++--- src/Service/CodeValidator/PhpValidator.php | 2 +- 10 files changed, 17 insertions(+), 19 deletions(-) rename .php_cs => .php-cs-fixer.dist.php (56%) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 64d7432..1a2f6bc 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -66,4 +66,4 @@ jobs: run: composer bin php-cs-fixer update --no-interaction --no-progress - name: Execute PHP CS Fixer - run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run + run: vendor/bin/php-cs-fixer fix --diff --dry-run diff --git a/.gitignore b/.gitignore index e286b4d..b0c94a7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ /public/bundles/ /var/ /vendor/ +/vendor-bin/php-cs-fixer/vendor/ +/vendor-bin/phpstan/vendor/ ###< symfony/framework-bundle ### diff --git a/.php_cs b/.php-cs-fixer.dist.php similarity index 56% rename from .php_cs rename to .php-cs-fixer.dist.php index 5e028c9..6fd4b38 100644 --- a/.php_cs +++ b/.php-cs-fixer.dist.php @@ -1,12 +1,12 @@ in(__DIR__.'/src') ->in(__DIR__.'/tests') ; -return PhpCsFixer\Config::create() - ->setCacheFile(__DIR__.'/.github/.cache/php-cs-fixer/.php_cs.cache') +return (new PhpCsFixer\Config()) + ->setCacheFile(__DIR__.'/.github/.cache/php-cs-fixer/.php-cs-fixer.cache') ->setRiskyAllowed(true) ->setRules([ '@PSR2' => true, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 859b44e..a493929 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,7 +7,3 @@ parameters: paths: - src tmpDir: .github/.cache/phpstan/ - - excludes_analyse: - - src/*/tests/* - - src/*/vendor/* diff --git a/src/Application.php b/src/Application.php index 581a717..c19a3b3 100644 --- a/src/Application.php +++ b/src/Application.php @@ -32,7 +32,7 @@ public function __construct(Kernel $kernel) * * @return int 0 if everything went fine, or an error code */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { $this->registerCommands(); @@ -66,7 +66,7 @@ protected function registerCommands() foreach ($container->getParameter('console.command.ids') as $id) { if (!isset($lazyCommandIds[$id])) { try { - $this->add($container->get($id)); + $this->addCommand($container->get($id)); } catch (\Throwable $e) { $this->registrationErrors[] = $e; } diff --git a/src/Command/CacheClearCommand.php b/src/Command/CacheClearCommand.php index 9f961bc..ada92a1 100644 --- a/src/Command/CacheClearCommand.php +++ b/src/Command/CacheClearCommand.php @@ -24,12 +24,12 @@ public function __construct(string $cacheDir) $this->cacheDirectory = $cacheDir; } - protected function configure() + protected function configure(): void { $this->setDescription('Clear the cache directory'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { (new Filesystem())->remove($this->cacheDirectory); diff --git a/src/Command/CheckDocsCommand.php b/src/Command/CheckDocsCommand.php index 59a985f..56b24b6 100644 --- a/src/Command/CheckDocsCommand.php +++ b/src/Command/CheckDocsCommand.php @@ -44,7 +44,7 @@ public function __construct(CodeValidator $validator, Baseline $baseline, CodeRu $this->codeRunner = $codeRunner; } - protected function configure() + protected function configure(): void { $this ->addArgument('source-dir', InputArgument::REQUIRED, 'RST files Source directory') @@ -57,7 +57,7 @@ protected function configure() ; } - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { $this->io = new SymfonyStyle($input, $output); diff --git a/src/Kernel.php b/src/Kernel.php index 10210d2..c94a192 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -69,7 +69,7 @@ public function boot() $container->compile(); - //dump the container + // dump the container file_put_contents( $containerDumpFile, (new PhpDumper($container))->dump(['class' => 'CachedContainer']) diff --git a/src/Service/Baseline.php b/src/Service/Baseline.php index 418021b..7e74f96 100644 --- a/src/Service/Baseline.php +++ b/src/Service/Baseline.php @@ -50,9 +50,9 @@ public function filter(IssueCollection $issues, array $baseline): IssueCollectio foreach ($fileIssues as $issue) { foreach ($fileBaseline as $i => $item) { if ( - $issue->getType() === $item['type'] && - $issue->getText() === $item['text'] && - $issue->getErroredLine() === $item['code'] + $issue->getType() === $item['type'] + && $issue->getText() === $item['text'] + && $issue->getErroredLine() === $item['code'] ) { unset($fileBaseline[$i]); continue 2; diff --git a/src/Service/CodeValidator/PhpValidator.php b/src/Service/CodeValidator/PhpValidator.php index 411ddba..408f7ed 100644 --- a/src/Service/CodeValidator/PhpValidator.php +++ b/src/Service/CodeValidator/PhpValidator.php @@ -54,7 +54,7 @@ private function getContents(CodeNode $node, &$linesPrepended = null): string $contents = str_replace(['...,', '...)', '...;', '...]', '... }'], ['null,', 'null)', 'null;', 'null]', '$a = null; }'], $contents); $lines = explode("\n", $contents); - if (!str_contains($lines[0] ?? '', '