From 8620dbff27d99efddb6198d4507996f0c727dca4 Mon Sep 17 00:00:00 2001 From: hakutaku <39969709+allhaileris@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:41:26 +0300 Subject: [PATCH] phpstan support --- .gitignore | 4 +++ .idea/php.xml | 6 ++++ .idea/symfony-skeleton.iml | 1 + Makefile | 3 ++ composer.json | 1 + composer.lock | 60 +++++++++++++++++++++++++++++++- src/Command/RrCommand.php | 2 +- src/Maker/Bundle/Bundle.tpl.php | 3 ++ src/Maker/Bundle/BundleMaker.php | 3 +- symfony.lock | 12 +++++++ 10 files changed, 91 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 70b8535..0b1b12d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ /phpunit.xml /.phpunit.cache/ ###< phpunit/phpunit ### + +###> phpstan/phpstan ### +phpstan.neon +###< phpstan/phpstan ### diff --git a/.idea/php.xml b/.idea/php.xml index 5a499ab..cf8c53a 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -120,9 +120,15 @@ + + + + + + diff --git a/.idea/symfony-skeleton.iml b/.idea/symfony-skeleton.iml index 1445054..482391b 100644 --- a/.idea/symfony-skeleton.iml +++ b/.idea/symfony-skeleton.iml @@ -114,6 +114,7 @@ + diff --git a/Makefile b/Makefile index fb677aa..ab8c93e 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ DOCKER_BUILD_COMMAND=docker build --file Dockerfile --no-cache --platform linux/ run: $(PWD)/bin/rr -c .rr.dev.yaml serve +stan: + vendor/bin/phpstan analyse src + up: $(DOCKER_BUILD_COMMAND) --build-arg APP_ENV=dev . docker compose --env-file .env up -d diff --git a/composer.json b/composer.json index a669a03..05dc128 100644 --- a/composer.json +++ b/composer.json @@ -86,6 +86,7 @@ } }, "require-dev": { + "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^11.5", "symfony/browser-kit": "7.3.*", "symfony/css-selector": "7.3.*", diff --git a/composer.lock b/composer.lock index 9ab1c24..463a559 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bb0d5bf7c87274180bd50cc78054e5f0", + "content-hash": "5b1f8e5de93f35b3a8390d46edf73f57", "packages": [ { "name": "baldinof/roadrunner-bundle", @@ -5951,6 +5951,64 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.1.28", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "578fa296a166605d97b94091f724f1257185d278" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578fa296a166605d97b94091f724f1257185d278", + "reference": "578fa296a166605d97b94091f724f1257185d278", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-09-19T08:58:49+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.11", diff --git a/src/Command/RrCommand.php b/src/Command/RrCommand.php index 26b5013..9556a81 100644 --- a/src/Command/RrCommand.php +++ b/src/Command/RrCommand.php @@ -39,7 +39,7 @@ class RrCommand extends Command 'command' => $serviceGroupName, 'memory' => $serviceInstance['memory_usage'], - 'error' => $serviceInstance['error'] + 'error' => !empty($serviceInstance['error']) ? $serviceInstance['error']['message'] : null, ]; diff --git a/src/Maker/Bundle/Bundle.tpl.php b/src/Maker/Bundle/Bundle.tpl.php index 0d64c9d..8152a8e 100644 --- a/src/Maker/Bundle/Bundle.tpl.php +++ b/src/Maker/Bundle/Bundle.tpl.php @@ -2,10 +2,13 @@ declare(strict_types=1); +// @phpstan-ignore-next-line namespace ; +// @phpstan-ignore-next-line +// @phpstan-ignore-next-line final class extends Bundle { diff --git a/src/Maker/Bundle/BundleMaker.php b/src/Maker/Bundle/BundleMaker.php index c2eead9..1d77a68 100644 --- a/src/Maker/Bundle/BundleMaker.php +++ b/src/Maker/Bundle/BundleMaker.php @@ -55,9 +55,8 @@ final class BundleMaker extends AbstractMaker ); } - public function configureDependencies(DependencyBuilder $dependencies) + public function configureDependencies(DependencyBuilder $dependencies): void { - // TODO: Implement configureDependencies() method. } private function createBundleFile(Generator $generator, string $bundleName): void diff --git a/symfony.lock b/symfony.lock index c442061..5940be9 100644 --- a/symfony.lock +++ b/symfony.lock @@ -47,6 +47,18 @@ "migrations/.gitignore" ] }, + "phpstan/phpstan": { + "version": "2.1", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.0", + "ref": "5e490cc197fb6bb1ae22e5abbc531ddc633b6767" + }, + "files": [ + "phpstan.dist.neon" + ] + }, "phpunit/phpunit": { "version": "12.3", "recipe": {