phpstan support

This commit is contained in:
hakutaku
2025-09-23 16:41:26 +03:00
parent 97441b9662
commit 8620dbff27
10 changed files with 91 additions and 4 deletions

4
.gitignore vendored
View File

@@ -17,3 +17,7 @@
/phpunit.xml /phpunit.xml
/.phpunit.cache/ /.phpunit.cache/
###< phpunit/phpunit ### ###< phpunit/phpunit ###
###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

6
.idea/php.xml generated
View File

@@ -120,9 +120,15 @@
<path value="$PROJECT_DIR$/vendor/sebastian/environment" /> <path value="$PROJECT_DIR$/vendor/sebastian/environment" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" /> <path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
<path value="$PROJECT_DIR$/vendor/sebastian/cli-parser" /> <path value="$PROJECT_DIR$/vendor/sebastian/cli-parser" />
<path value="$PROJECT_DIR$/vendor/phpstan/phpstan" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" /> <component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
<component name="PhpStan">
<PhpStan_settings>
<PhpStanConfiguration tool_path="$PROJECT_DIR$/vendor/bin/phpstan" />
</PhpStan_settings>
</component>
<component name="PhpStanOptionsConfiguration"> <component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>

View File

@@ -114,6 +114,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/cli-parser" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/cli-parser" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpstan/phpstan" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@@ -4,6 +4,9 @@ DOCKER_BUILD_COMMAND=docker build --file Dockerfile --no-cache --platform linux/
run: run:
$(PWD)/bin/rr -c .rr.dev.yaml serve $(PWD)/bin/rr -c .rr.dev.yaml serve
stan:
vendor/bin/phpstan analyse src
up: up:
$(DOCKER_BUILD_COMMAND) --build-arg APP_ENV=dev . $(DOCKER_BUILD_COMMAND) --build-arg APP_ENV=dev .
docker compose --env-file .env up -d docker compose --env-file .env up -d

View File

@@ -86,6 +86,7 @@
} }
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5", "phpunit/phpunit": "^11.5",
"symfony/browser-kit": "7.3.*", "symfony/browser-kit": "7.3.*",
"symfony/css-selector": "7.3.*", "symfony/css-selector": "7.3.*",

60
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "bb0d5bf7c87274180bd50cc78054e5f0", "content-hash": "5b1f8e5de93f35b3a8390d46edf73f57",
"packages": [ "packages": [
{ {
"name": "baldinof/roadrunner-bundle", "name": "baldinof/roadrunner-bundle",
@@ -5951,6 +5951,64 @@
}, },
"time": "2022-02-21T01:04:05+00:00" "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", "name": "phpunit/php-code-coverage",
"version": "11.0.11", "version": "11.0.11",

View File

@@ -39,7 +39,7 @@ class RrCommand extends Command
'command' => $serviceGroupName, 'command' => $serviceGroupName,
'memory' => $serviceInstance['memory_usage'], 'memory' => $serviceInstance['memory_usage'],
'error' => $serviceInstance['error'] 'error' => !empty($serviceInstance['error'])
? $serviceInstance['error']['message'] ? $serviceInstance['error']['message']
: null, : null,
]; ];

View File

@@ -2,10 +2,13 @@
declare(strict_types=1); declare(strict_types=1);
// @phpstan-ignore-next-line
namespace <?= $namespace; ?>; namespace <?= $namespace; ?>;
// @phpstan-ignore-next-line
<?= $use_statements; ?> <?= $use_statements; ?>
// @phpstan-ignore-next-line
final class <?= $class_name; ?> extends Bundle final class <?= $class_name; ?> extends Bundle
{ {

View File

@@ -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 private function createBundleFile(Generator $generator, string $bundleName): void

View File

@@ -47,6 +47,18 @@
"migrations/.gitignore" "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": { "phpunit/phpunit": {
"version": "12.3", "version": "12.3",
"recipe": { "recipe": {