Skip to content

Commit 570132f

Browse files
committed
run phpstan on src/Maker and related tests
1 parent 07614b5 commit 570132f

File tree

5 files changed

+148
-0
lines changed

5 files changed

+148
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 (${{ 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+
59+
phpstan:
60+
name: PHPStan
61+
62+
runs-on: ubuntu-latest
63+
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
php-version:
68+
- '8.1'
69+
70+
steps:
71+
- name: Checkout
72+
uses: "actions/checkout@v4"
73+
74+
- name: Install PHP
75+
uses: "shivammathur/setup-php@v2"
76+
77+
- name: Install Composer Dependencies
78+
uses: "ramsey/composer-install@v2"
79+
with:
80+
composer-options: "--no-scripts"
81+
82+
- name: Install PHPStan
83+
uses: "ramsey/composer-install@v2"
84+
with:
85+
composer-options: "--no-scripts --working-dir=tools/phpstan"
86+
87+
- name: Install Optional Dependencies
88+
uses: "ramsey/composer-install@v2"
89+
with:
90+
composer-options: "--no-scripts --working-dir=tools/phpstan/includes"
91+
92+
- name: Run PHPStan
93+
run: "tools/phpstan/vendor/bin/phpstan --memory-limit=1G"

phpstan.dist.neon

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
level: 6
3+
bootstrapFiles:
4+
- tools/phpstan/includes/vendor/autoload.php
5+
- vendor/autoload.php
6+
paths:
7+
- src/Maker
8+
- tests/Maker
9+
# - tests
10+
# symfony:
11+
# containerXmlPath: var/cache/test/App_KernelTestDebugContainer.xml
12+
# doctrine:
13+
# ormRepositoryClass: App\Repository\AbstractRepository
14+
# objectManagerLoader: tests/phpstan-bootstrap.php
15+
# ignoreErrors:
16+
# -
17+
# message: '#Variable \$[a-zA-Z0-9]+ might not be defined\.#'
18+
## identifier: variable.undefined // Available in phpstan 1.11.0
19+
# 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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"require": {
3+
"symfonycasts/reset-password-bundle": "^1.21",
4+
"symfony/mailer": "^7.0",
5+
"symfony/form": "^7.0",
6+
"symfony/validator": "^7.0",
7+
"symfony/security-bundle": "^7.0",
8+
"symfony/twig-bundle": "^7.0",
9+
"doctrine/doctrine-bundle": "^2.12",
10+
"symfony/orm-pack": "^2.4",
11+
"doctrine/doctrine-fixtures-bundle": "^3.5",
12+
"symfony/messenger": "^7.0",
13+
"symfony/scheduler": "^7.0",
14+
"api-platform/core": "^3.2",
15+
"symfonycasts/verify-email-bundle": "^1.17",
16+
"symfony/ux-turbo": "^2.16",
17+
"symfony/ux-live-component": "^2.16"
18+
}
19+
}

0 commit comments

Comments
 (0)