Skip to content

Commit 27e911f

Browse files
authored
Add support for running phpstan and generating the baseline (#37)
* Autoload phpstan rules * Makefile targets * Fix work dir * Readme
1 parent 3df46a7 commit 27e911f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ endif
88

99
ifneq ("$(shell whoami)", "skpr")
1010
EXEC=$(DOCKER_COMPOSE) exec -T php-cli
11+
EXEC_APP=$(DOCKER_COMPOSE) exec -w /data/app -T php-cli
1112
endif
1213

1314
DRUSH=$(EXEC) ./bin/drush
@@ -45,6 +46,12 @@ login:
4546
switch:
4647
$(GIT_SWITCH) $(BRANCH)
4748

49+
phpstan:
50+
$(EXEC_APP) /data/bin/phpstan --configuration=./core/phpstan.neon.dist --memory-limit=1G
51+
52+
phpstan-baseline:
53+
$(EXEC_APP) /data/bin/phpstan --configuration=./core/phpstan.neon.dist --generate-baseline=./core/.phpstan-baseline.php --memory-limit=1G
54+
4855
9.3: php8.0
4956
$(GIT_SWITCH) 9.3.x
5057
make clean

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Make commands should be executed on the host machine.
5151
* `umami` - installs Drupal with the demo_umami profile
5252
* `login` - gets a one-time login link
5353
* `switch` - switches branch, e.g. `make BRANCH=9.3 switch`
54+
* `phpstan` - runs phpstan for core
55+
* `phpstan-baseline` - generates phpstan baseline for core
5456
* `10.2|10.3|10.4|10.5|11.0|11.1|11.x` - provides a clean environment with the specified Drupal version
5557
* `php8.1|php8.2|php8.3` - starts the stack with the specified php version
5658

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
"mstrelan\\DrupalContrib\\": "src/"
7777
}
7878
},
79+
"autoload-dev": {
80+
"psr-4": {
81+
"Drupal\\PHPStan\\Rules\\": "app/core/tests/PHPStan/Rules"
82+
}
83+
},
7984
"extra": {
8085
"drupal-scaffold": {
8186
"locations": {

0 commit comments

Comments
 (0)