Skip to content

Commit 50114a5

Browse files
committed
run phpstan on src/Maker and related tests
1 parent 9fa3eaf commit 50114a5

File tree

6 files changed

+158
-43
lines changed

6 files changed

+158
-43
lines changed

.github/workflows/ci-linux.yaml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,6 @@ env:
1313
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
1414

1515
jobs:
16-
coding-standards:
17-
name: "Coding Standards (${{ matrix.php-version }})"
18-
19-
runs-on: ubuntu-latest
20-
21-
strategy:
22-
fail-fast: false
23-
matrix:
24-
php-version:
25-
- '8.1'
26-
27-
steps:
28-
-
29-
name: Checkout code
30-
uses: "actions/checkout@v3"
31-
32-
-
33-
name: Install PHP
34-
uses: "shivammathur/setup-php@v2"
35-
with:
36-
coverage: "none"
37-
php-version: "${{ matrix.php-version }}"
38-
39-
-
40-
name: Validate composer.json
41-
run: "composer validate --strict --no-check-lock"
42-
43-
-
44-
name: Composer install
45-
uses: "ramsey/composer-install@v2"
46-
with:
47-
composer-options: "--no-scripts"
48-
49-
-
50-
name: Composer install php-cs-fixer
51-
uses: "ramsey/composer-install@v2"
52-
with:
53-
composer-options: "--no-scripts --working-dir=tools/php-cs-fixer"
54-
55-
-
56-
name: Run PHP-CS-Fixer
57-
run: "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff"
58-
5916
test:
6017
name: "PHP ${{ matrix.php-version }} + @${{ matrix.symfony-version }} ${{ matrix.dependency-versions }} deps"
6118

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: "CI Static Analysis"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'main'
8+
# schedule:
9+
# - cron: '0 0 * * *'
10+
11+
env:
12+
PHPUNIT_FLAGS: "-v"
13+
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
14+
15+
jobs:
16+
coding-standards:
17+
name: "Coding Standards"
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
-
23+
name: Checkout code
24+
uses: "actions/checkout@v3"
25+
26+
-
27+
name: Install PHP
28+
uses: "shivammathur/setup-php@v2"
29+
30+
-
31+
name: Validate composer.json
32+
run: "composer validate --strict --no-check-lock"
33+
34+
-
35+
name: Composer install
36+
uses: "ramsey/composer-install@v2"
37+
with:
38+
composer-options: "--no-scripts"
39+
40+
-
41+
name: Composer install php-cs-fixer
42+
uses: "ramsey/composer-install@v2"
43+
with:
44+
composer-options: "--no-scripts --working-dir=tools/php-cs-fixer"
45+
46+
-
47+
name: Run PHP-CS-Fixer
48+
run: "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff"
49+
50+
phpstan:
51+
name: PHPStan
52+
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Checkout
57+
uses: "actions/checkout@v4"
58+
59+
- name: Install PHP
60+
uses: "shivammathur/setup-php@v2"
61+
62+
- name: Install Composer Dependencies
63+
uses: "ramsey/composer-install@v2"
64+
with:
65+
composer-options: "--no-scripts"
66+
67+
- name: Install PHPStan
68+
uses: "ramsey/composer-install@v2"
69+
with:
70+
composer-options: "--no-scripts --working-dir=tools/phpstan"
71+
72+
- name: Install Optional Dependencies
73+
uses: "ramsey/composer-install@v2"
74+
with:
75+
composer-options: "--no-scripts --working-dir=tools/phpstan/includes"
76+
77+
- name: Install PHPUnit
78+
run: "vendor/bin/simple-phpunit --version"
79+
80+
- name: Run PHPStan
81+
run: "tools/phpstan/vendor/bin/phpstan analyze --memory-limit=1G --error-format=github"

phpstan.dist.neon

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
parameters:
2+
level: 6
3+
bootstrapFiles:
4+
- vendor/autoload.php
5+
- tools/phpstan/includes/vendor/autoload.php
6+
paths:
7+
- src/Maker
8+
- tests/Command
9+
- tests/Docker
10+
- tests/Maker
11+
excludePaths:
12+
- tests/Doctrine/fixtures
13+
- tests/fixtures
14+
- tests/Security/fixtures
15+
- tests/Security/yaml_fixtures
16+
- tests/tmp
17+
- tests/Util/fixtures
18+
- tests/Util/yaml_fixtures
19+
ignoreErrors:
20+
-
21+
message: '#Property .+phpCompatUtil is never read, only written\.#'
22+
path: src/Maker/*
23+
24+
-
25+
message: '#Class Symfony\\Bundle\\MakerBundle\\Maker\\LegacyApiTestCase not found#'
26+
path: src/Maker/*
27+
28+
# - tests
29+
# symfony:
30+
# containerXmlPath: var/cache/test/App_KernelTestDebugContainer.xml
31+
# doctrine:
32+
# ormRepositoryClass: App\Repository\AbstractRepository
33+
# objectManagerLoader: tests/phpstan-bootstrap.php
34+
# ignoreErrors:
35+
# -
36+
# message: '#Variable \$[a-zA-Z0-9]+ might not be defined\.#'
37+
## identifier: variable.undefined // Available in phpstan 1.11.0
38+
# path: src/GraphQLRequest/*

tools/phpstan/composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"require": {
3+
"phpstan/phpstan": "^1.10",
4+
"phpstan/extension-installer": "^1.3",
5+
"phpstan/phpstan-symfony": "^1.3",
6+
"phpstan/phpstan-doctrine": "^1.3",
7+
"phpstan/phpstan-phpunit": "^1.3"
8+
},
9+
"config": {
10+
"allow-plugins": {
11+
"phpstan/extension-installer": true
12+
}
13+
}
14+
}

tools/phpstan/includes/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!.gitignore
3+
!composer.json

tools/phpstan/includes/composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"require": {
3+
"api-platform/core": "^3.2",
4+
"doctrine/doctrine-bundle": "^2.12",
5+
"doctrine/doctrine-fixtures-bundle": "^3.5",
6+
"symfony/form": "^7.0",
7+
"symfony/mailer": "^7.0",
8+
"symfony/messenger": "^7.0",
9+
"symfony/orm-pack": "^2.4",
10+
"symfony/scheduler": "^7.0",
11+
"symfony/security-bundle": "^7.0",
12+
"symfony/test-pack": "^1.1",
13+
"symfony/twig-bundle": "^7.0",
14+
"symfony/ux-live-component": "^2.16",
15+
"symfony/ux-turbo": "^2.16",
16+
"symfony/validator": "^7.0",
17+
"symfonycasts/reset-password-bundle": "^1.21",
18+
"symfonycasts/verify-email-bundle": "^1.17",
19+
"symfony/webpack-encore-bundle": "^2.1",
20+
"symfony/panther": "^2.1"
21+
}
22+
}

0 commit comments

Comments
 (0)