Skip to content

Feature/#93 add phpstan extension installer #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 4, 2023

Conversation

hkirsman
Copy link
Collaborator

@hkirsman hkirsman commented May 4, 2023

Description

Drupal 10 code-dev requires this package phpstan/extension-installer that loads php_stan .neon files automatically. Currently we have them like on the screenshot.

This PR requires adds the requirement to Code Quality and removes the lines from default config. This way we're more in sync with Drupal 10 and automatic loading seems nice feature.

Here's more information on the package https://github.com/phpstan/extension-installer

Screenshots

236185511-f7f457e1-f48a-4b59-923b-1b8d9c218c04

Testing notes

Install via composer:

lando composer require wunderio/code-quality:dev-feature/93-add-phpstan-extension-installer --dev

Copy over the new .neon file

cp vendor/wunderio/code-quality/config/phpstan.neon ./phpstan.neon

Optionally disable other tasks in grumphp.yml for faster test run:

grumphp:
  stop_on_failure: true
  process_timeout: 300
  ascii:
    failed: ~
    succeeded: ~
  tasks:
#    php_compatibility: ~
#    check_file_permissions: ~
#    php_check_syntax: ~
#    phpcs: ~
    php_stan: ~
#    yaml_lint: ~
#    json_lint: ~
#    psalm: ~
  extensions:
    - Wunderio\GrumPHP\Task\PhpCompatibility\PhpCompatibilityExtensionLoader
    - Wunderio\GrumPHP\Task\PhpCheckSyntax\PhpCheckSyntaxExtensionLoader
    - Wunderio\GrumPHP\Task\CheckFilePermissions\CheckFilePermissionsExtensionLoader
    - Wunderio\GrumPHP\Task\Ecs\EcsExtensionLoader
    - Wunderio\GrumPHP\Task\Phpcs\PhpcsExtensionLoader
    - Wunderio\GrumPHP\Task\PhpStan\PhpStanExtensionLoader
    - Wunderio\GrumPHP\Task\YamlLint\YamlLintExtensionLoader
    - Wunderio\GrumPHP\Task\JsonLint\JsonLintExtensionLoader
    - Wunderio\GrumPHP\Task\Psalm\PsalmExtensionLoader

Depending on your environment, run grumphp on your codebase

lando grumphp run

or

lando ssh
./vendor/bin/grumphp run

@hkirsman hkirsman changed the title Feature/93 add phpstan extension installer Feature/#93 add phpstan extension installer May 4, 2023
@hkirsman hkirsman changed the title Feature/#93 add phpstan extension installer Feature / #93 add phpstan extension installer May 4, 2023
@hkirsman hkirsman changed the title Feature / #93 add phpstan extension installer Feature/#93 add phpstan extension installer May 4, 2023
@hkirsman hkirsman requested a review from vermario May 4, 2023 11:31
Copy link

@vermario vermario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on the D10 version of a project and phpstan runs happily!

"extra": {
"phpstan/extension-installer": {
"ignore": [
"mglaman/phpstan-drupal"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circleci tests would fail if this is run inside this package without Drupal. Before only one rule was included the below phpstan.neon but now phpstan/extension-installer was icluding also this.

@hkirsman hkirsman merged commit ada3510 into main May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants