PHPStan was fairly recently added to GitlabCI for Previous Major. As this is running against D10, it doesn't recognize D11 attributes, so PHPStan reports the following errors:
------ -----------------------------------------------------------------
Line src/Hook/TokensHooks.php
------ -----------------------------------------------------------------
18 Attribute class Drupal\Core\Hook\Attribute\Hook does not exist.
45 Attribute class Drupal\Core\Hook\Attribute\Hook does not exist.
------ -----------------------------------------------------------------
------ -----------------------------------------------------------------
Line src/Hook/VerifyEmailHooks.php
------ -----------------------------------------------------------------
19 Attribute class Drupal\Core\Hook\Attribute\Hook does not exist.
30 Attribute class Drupal\Core\Hook\Attribute\Hook does not exist.
------ -----------------------------------------------------------------
------ --------------------------------------------------------------------
Line tests/src/Functional/VerifyEmailRoutingTest.php
------ --------------------------------------------------------------------
18 Attribute class PHPUnit\Framework\Attributes\Group does not exist.
------ --------------------------------------------------------------------
------ --------------------------------------------------------------------
Line tests/src/Functional/VerifyEmailSetupTest.php
------ --------------------------------------------------------------------
13 Attribute class PHPUnit\Framework\Attributes\Group does not exist.
------ --------------------------------------------------------------------
------ -----------------------------------------------------------------------
Line verify_email.module
------ -----------------------------------------------------------------------
17 Attribute class Drupal\Core\Hook\Attribute\LegacyHook does not exist.
25 Attribute class Drupal\Core\Hook\Attribute\LegacyHook does not exist.
33 Attribute class Drupal\Core\Hook\Attribute\LegacyHook does not exist.
41 Attribute class Drupal\Core\Hook\Attribute\LegacyHook does not exist.
------ -----------------------------------------------------------------------
[ERROR] Found 10 errors
Add a "before script" to GitlabCI to remove the Hook attributes before PHPStan runs for previous major.
See pipeline: https://git.drupalcode.org/issue/verify_email-3545565/-/jobs/6506464
Add a "before script" to .gitlab-ci.yml
to remove the Hook attributes before PHPStan runs for previous major. This will mean that when PHPStan runs for previous major, the attributes will not be present. However, as the script only gets run for that specific instance, everything else will be properly checked.
.gitlab-ci.yml
: phpstan (previous major):
before_script:
- sed -i '/#\[LegacyHook\]/d' $DRUPAL_PROJECT_FOLDER/*.module
#[Hook]
and #[Group]
attributes, but update the paths to the test directories.N/A
N/A
N/A
Active
1.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.