Skip to content

Commit

Permalink
build: add phpstan 1 check also for if we are gonna support both vers…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
bbrala committed Jan 31, 2025
1 parent afcbdb0 commit 024b06d
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ jobs:
name: Static analysis with PHPStan
# START: SHARED SETUP
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php-version: "8.2"
rector: "^1"
phpstan-config: phpstan-1.neon
- php-version: "8.2"
rector: "^2"
phpstan-config: phpstan.neon
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
Expand All @@ -28,5 +37,5 @@ jobs:
# uses: mxschmitt/action-tmate@v2
# END: SHARED SETUP

- run: composer install
- run: composer phpstan
- run: composer require rector/rector:${{ matrix.rector }} --dev
- run: vendor/bin/phpstan analyse -c ${{ matrix.phpstan-config }}
159 changes: 159 additions & 0 deletions phpstan-1-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
parameters:
ignoreErrors:
-
message: "#^Access to undefined constant Rector\\\\Symfony\\\\Set\\\\TwigSetList\\:\\:TWIG_24\\.$#"
count: 1
path: config/drupal-10/drupal-10.0-deprecations.php

-
message: "#^Access to undefined constant Rector\\\\Symfony\\\\Set\\\\TwigSetList\\:\\:TWIG_24\\.$#"
count: 1
path: config/drupal-9/drupal-9.0-deprecations.php

-
message: """
#^Call to deprecated method locateRoot\\(\\) of class DrupalFinder\\\\DrupalFinder\\:
Will be removed in v2\\. Future usage should instantiate
a new DrupalFinder object by passing the starting path to its
constructor\\.$#
"""
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_contrib_extension_directory_roots\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_find_extension_directories\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_get_extension_namespaces\\(\\) has parameter \\$dirs with no value type specified in iterable type array\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_get_extension_namespaces\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_populate_class_loader\\(\\) has no return type specified\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_populate_class_loader\\(\\) has parameter \\$drupalRoot with no type specified\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: "#^Function drupal_phpunit_populate_class_loader\\(\\) has parameter \\$vendorRoot with no type specified\\.$#"
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: """
#^Instantiation of deprecated class DrupalFinder\\\\DrupalFinder\\:
in drupal\\-finder\\:1\\.3\\.0 and is removed from drupal\\-finder\\:2\\.0\\.0\\.
Use \\\\DrupalFinder\\\\DrupalFinderComposerRuntime instead\\.$#
"""
count: 1
path: config/drupal-phpunit-bootstrap-file.php

-
message: """
#^Call to deprecated method locateRoot\\(\\) of class DrupalFinder\\\\DrupalFinder\\:
Will be removed in v2\\. Future usage should instantiate
a new DrupalFinder object by passing the starting path to its
constructor\\.$#
"""
count: 1
path: rector.php

-
message: """
#^Instantiation of deprecated class DrupalFinder\\\\DrupalFinder\\:
in drupal\\-finder\\:1\\.3\\.0 and is removed from drupal\\-finder\\:2\\.0\\.0\\.
Use \\\\DrupalFinder\\\\DrupalFinderComposerRuntime instead\\.$#
"""
count: 1
path: rector.php

-
message: "#^Access to an undefined property PhpParser\\\\Node\\\\Expr\\:\\:\\$value\\.$#"
count: 2
path: src/Drupal8/Rector/Deprecation/DBRector.php

-
message: "#^Call to an undefined method PHPStan\\\\Type\\\\Type\\:\\:getValue\\(\\)\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/DrupalSetMessageRector.php

-
message: "#^Access to an undefined property PhpParser\\\\Node\\\\Expr\\:\\:\\$expr\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityLoadRector.php

-
message: "#^Access to an undefined property PhpParser\\\\Node\\\\Expr\\:\\:\\$expr\\.$#"
count: 2
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Access to an undefined property PhpParser\\\\Node\\\\Expr\\:\\:\\$name\\.$#"
count: 3
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Method DrupalRector\\\\Drupal8\\\\Rector\\\\Deprecation\\\\EntityManagerRector\\:\\:getServiceByMethodName\\(\\) has no return type specified\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$node$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Parameter \\#1 \\$assign of method DrupalRector\\\\Drupal8\\\\Rector\\\\Deprecation\\\\EntityManagerRector\\:\\:findInstanceByNameInAssign\\(\\) expects PhpParser\\\\Node\\\\Expr\\\\Assign, PhpParser\\\\Node\\\\Expr given\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Parameter \\#1 \\$assign of method DrupalRector\\\\Drupal8\\\\Rector\\\\Deprecation\\\\EntityManagerRector\\:\\:replaceInstanceByNameInAssign\\(\\) expects PhpParser\\\\Node\\\\Expr\\\\Assign, PhpParser\\\\Node\\\\Expr given\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Parameter \\#1 \\$expr of method DrupalRector\\\\Drupal8\\\\Rector\\\\Deprecation\\\\EntityManagerRector\\:\\:refactorExpression\\(\\) expects PhpParser\\\\Node\\\\Expr\\\\MethodCall\\|PhpParser\\\\Node\\\\Expr\\\\StaticCall, PhpParser\\\\Node given\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Parameter \\#1 \\$expr of method DrupalRector\\\\Drupal8\\\\Rector\\\\Deprecation\\\\EntityManagerRector\\:\\:refactorExpression\\(\\) expects PhpParser\\\\Node\\\\Expr\\\\MethodCall\\|PhpParser\\\\Node\\\\Expr\\\\StaticCall, PhpParser\\\\Node\\\\Expr given\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Property PhpParser\\\\Node\\\\Expr\\\\Assign\\:\\:\\$expr \\(PhpParser\\\\Node\\\\Expr\\) does not accept PhpParser\\\\Node\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/EntityManagerRector.php

-
message: "#^Calling PHPStan\\\\Php\\\\PhpVersionFactory\\:\\:create\\(\\) is not covered by backward compatibility promise\\. The method might change in a minor PHPStan version\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/FunctionalTestDefaultThemePropertyRector.php

-
message: "#^Method PHPStan\\\\Type\\\\Type\\:\\:isSmallerThanOrEqual\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 1
path: src/Drupal8/Rector/Deprecation/FunctionalTestDefaultThemePropertyRector.php

-
message: "#^Call to an undefined method PHPStan\\\\Type\\\\Type\\:\\:getValue\\(\\)\\.$#"
count: 1
path: src/Drupal9/Rector/Deprecation/ExtensionPathRector.php
12 changes: 12 additions & 0 deletions phpstan-1.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
level: 6
paths:
- config
- src
- rector.php
bootstrapFiles:
- vendor/rector/rector/vendor/autoload.php
dynamicConstantNames:
- Drupal::VERSION
includes:
- phpstan-1-baseline.neon

0 comments on commit 024b06d

Please sign in to comment.