Issue #3426548 by Kingdutch, andypost, longwave, catch, mstrelan, alexpott: Convert the PHPStan baseline from NEON to PHP

merge-requests/6829/merge
Alex Pott 2024-03-12 14:42:22 +00:00
parent ac8556f35e
commit 9b890f0414
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
7 changed files with 2753 additions and 2884 deletions

3
.gitattributes vendored
View File

@ -42,6 +42,9 @@
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 *.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 *.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
# PHPStan's baseline uses tabs instead of spaces.
core/.phpstan-baseline.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tabwidth=2 diff=php linguist-language=php
# Define binary file attributes. # Define binary file attributes.
# - Do not treat them as text. # - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ." # - Include binary diff in patches instead of "binary files differ."

View File

@ -378,7 +378,7 @@ default:
php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress || true php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress || true
# Generate a new baseline. # Generate a new baseline.
echo "Generating an PHPStan baseline file (available as job artifact)." echo "Generating an PHPStan baseline file (available as job artifact)."
php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress --generate-baseline=./core/phpstan-baseline.neon || true php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --no-progress --generate-baseline=./core/.phpstan-baseline.php || true
exit $EXIT_CODE exit $EXIT_CODE
fi fi
@ -389,7 +389,7 @@ default:
# Only store the baseline if the job fails. # Only store the baseline if the job fails.
when: on_failure when: on_failure
paths: paths:
- core/phpstan-baseline.neon - core/.phpstan-baseline.php
'🧹 PHP Coding standards (PHPCS)': '🧹 PHP Coding standards (PHPCS)':
<<: [ *with-composer, *default-job-settings-lint ] <<: [ *with-composer, *default-job-settings-lint ]

2743
core/.phpstan-baseline.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@
<exclude-pattern>*/node_modules/*</exclude-pattern> <exclude-pattern>*/node_modules/*</exclude-pattern>
<!--Exclude third party code.--> <!--Exclude third party code.-->
<exclude-pattern>./assets/vendor/*</exclude-pattern> <exclude-pattern>./assets/vendor/*</exclude-pattern>
<!--Exclude the PHPStan baseline from coding standards.-->
<exclude-pattern>./core/.phpstan-baseline.php</exclude-pattern>
<!-- Exclude third-party code maintained within core that does not follow our standards. --> <!-- Exclude third-party code maintained within core that does not follow our standards. -->
<!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. --> <!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. -->
<exclude-pattern>./core/lib/Drupal/Component/Diff/</exclude-pattern> <exclude-pattern>./core/lib/Drupal/Component/Diff/</exclude-pattern>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
# Configuration file for PHPStan static code checking, see https://phpstan.org . # Configuration file for PHPStan static code checking, see https://phpstan.org .
# PHPStan is triggered on Drupal CI in commit-code-check.sh. # PHPStan is triggered on Drupal CI in commit-code-check.sh.
includes: includes:
- phpstan-baseline.neon - .phpstan-baseline.php
- phar://phpstan.phar/conf/bleedingEdge.neon - phar://phpstan.phar/conf/bleedingEdge.neon
parameters: parameters:

View File

@ -112,7 +112,7 @@ TOP_LEVEL=$($GIT rev-parse --show-toplevel)
# This variable will be set to one when the file core/phpcs.xml.dist is changed. # This variable will be set to one when the file core/phpcs.xml.dist is changed.
PHPCS_XML_DIST_FILE_CHANGED=0 PHPCS_XML_DIST_FILE_CHANGED=0
# This variable will be set to one when the files core/phpstan-baseline.neon or # This variable will be set to one when the files core/.phpstan-baseline.php or
# core/phpstan.neon.dist are changed. # core/phpstan.neon.dist are changed.
PHPSTAN_DIST_FILE_CHANGED=0 PHPSTAN_DIST_FILE_CHANGED=0
@ -153,7 +153,7 @@ for FILE in $FILES; do
PHPCS_XML_DIST_FILE_CHANGED=1; PHPCS_XML_DIST_FILE_CHANGED=1;
fi; fi;
if [[ $FILE == "core/phpstan-baseline.neon" || $FILE == "core/phpstan.neon.dist" ]]; then if [[ $FILE == "core/.phpstan-baseline.php" || $FILE == "core/phpstan.neon.dist" ]]; then
PHPSTAN_DIST_FILE_CHANGED=1; PHPSTAN_DIST_FILE_CHANGED=1;
fi; fi;