Skip to content

Commit

Permalink
Add support for running phpstan and generating the baseline (#37)
Browse files Browse the repository at this point in the history
* Autoload phpstan rules

* Makefile targets

* Fix work dir

* Readme
  • Loading branch information
mstrelan authored Feb 3, 2025
1 parent 3df46a7 commit 27e911f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ endif

ifneq ("$(shell whoami)", "skpr")
EXEC=$(DOCKER_COMPOSE) exec -T php-cli
EXEC_APP=$(DOCKER_COMPOSE) exec -w /data/app -T php-cli
endif

DRUSH=$(EXEC) ./bin/drush
Expand Down Expand Up @@ -45,6 +46,12 @@ login:
switch:
$(GIT_SWITCH) $(BRANCH)

phpstan:
$(EXEC_APP) /data/bin/phpstan --configuration=./core/phpstan.neon.dist --memory-limit=1G

phpstan-baseline:
$(EXEC_APP) /data/bin/phpstan --configuration=./core/phpstan.neon.dist --generate-baseline=./core/.phpstan-baseline.php --memory-limit=1G

9.3: php8.0
$(GIT_SWITCH) 9.3.x
make clean
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Make commands should be executed on the host machine.
* `umami` - installs Drupal with the demo_umami profile
* `login` - gets a one-time login link
* `switch` - switches branch, e.g. `make BRANCH=9.3 switch`
* `phpstan` - runs phpstan for core
* `phpstan-baseline` - generates phpstan baseline for core
* `10.2|10.3|10.4|10.5|11.0|11.1|11.x` - provides a clean environment with the specified Drupal version
* `php8.1|php8.2|php8.3` - starts the stack with the specified php version

Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
"mstrelan\\DrupalContrib\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\PHPStan\\Rules\\": "app/core/tests/PHPStan/Rules"
}
},
"extra": {
"drupal-scaffold": {
"locations": {
Expand Down

0 comments on commit 27e911f

Please sign in to comment.