Skip to content

Commit a42bd7c

Browse files
authored
Add PHP 8.3 to workflow (#729)
* Add PHP 8.3 to workflow fixes #726 * d9 doesn't support 8.3 * RouteObjectInterface not found * phpstan fixes * phpcs * more class_exist * try something * i don't get it! * fix some logic * // @phpstan-ignore-next-line
1 parent ab08481 commit a42bd7c

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.github/workflows/php.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- "8.0"
1919
- "8.1"
2020
- "8.2"
21+
- "8.3"
2122
steps:
2223
- name: "Checkout"
2324
uses: "actions/checkout@v4"
@@ -28,6 +29,12 @@ jobs:
2829
php-version: "${{ matrix.php-version }}"
2930
tools: composer:v2
3031
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd
32+
- name: "Upgrade to drupal/core:^10"
33+
run: "composer require drupal/core-recommended:^10 --with-all-dependencies --dev --no-update"
34+
if: ${{ matrix.php-version == '8.3' }}
35+
- name: "Add phpspec/prophecy-phpunit"
36+
run: "composer require phpspec/prophecy-phpunit:^2 --dev --no-update"
37+
if: ${{ matrix.php-version == '8.3' }}
3138
- name: "Install dependencies"
3239
uses: "ramsey/composer-install@v3"
3340
- name: "PHPCS"
@@ -61,6 +68,9 @@ jobs:
6168
- php-version: "8.2"
6269
drupal: "11.x-dev"
6370
experimental: true
71+
- php-version: "8.3"
72+
drupal: "11.x-dev"
73+
experimental: true
6474
steps:
6575
- name: "Checkout"
6676
uses: "actions/checkout@v4"
@@ -105,6 +115,9 @@ jobs:
105115
- php-version: "8.2"
106116
drupal: "11.x-dev"
107117
experimental: true
118+
- php-version: "8.3"
119+
drupal: "11.x-dev"
120+
experimental: true
108121
steps:
109122
- name: "Checkout"
110123
uses: "actions/checkout@v4"

src/Rules/Deprecations/SymfonyCmfRouteObjectInterfaceConstantsRule.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ public function processNode(Node $node, Scope $scope): array
4242
return [];
4343
}
4444
[$major, $minor] = explode('.', Drupal::VERSION, 3);
45-
if ($major !== '9' && (int) $minor > 1) {
45+
if ($major !== '9') {
4646
return [];
4747
}
48+
if ((int) $minor < 1) {
49+
return [];
50+
}
51+
52+
// @phpstan-ignore-next-line
4853
$cmfRouteObjectInterfaceType = new ObjectType(SymfonyRouteObjectInterface::class);
4954
if (!$classType->isSuperTypeOf($cmfRouteObjectInterfaceType)->yes()) {
5055
return [];

src/Rules/Deprecations/SymfonyCmfRoutingInClassMethodSignatureRule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ public function processNode(Node $node, Scope $scope): array
3939
}
4040
$method = $node->getMethodReflection();
4141

42+
// @phpstan-ignore-next-line
4243
$cmfRouteObjectInterfaceType = new ObjectType(RouteObjectInterface::class);
44+
// @phpstan-ignore-next-line
4345
$cmfRouteProviderInterfaceType = new ObjectType(RouteProviderInterface::class);
46+
// @phpstan-ignore-next-line
4447
$cmfLazyRouteCollectionType = new ObjectType(LazyRouteCollection::class);
4548

4649
$methodSignature = ParametersAcceptorSelector::selectSingle($method->getVariants());

src/Rules/Drupal/RequestStackGetMainRequestRule.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace mglaman\PHPStanDrupal\Rules\Drupal;
44

55
use Drupal;
6-
use Drupal\Core\Http\RequestStack as DrupalRequestStack;
76
use mglaman\PHPStanDrupal\Internal\DeprecatedScopeCheck;
87
use PhpParser\Node;
98
use PHPStan\Analyser\Scope;
@@ -32,7 +31,7 @@ public function processNode(Node $node, Scope $scope): array
3231
}
3332
[$major, $minor] = explode('.', Drupal::VERSION, 3);
3433
// Only valid for 9.3 -> 9.5. Deprecated in Drupal 10.
35-
if ($major !== '9' || (int) $minor < 3) {
34+
if (($major !== '9' || (int) $minor < 3)) {
3635
return [];
3736
}
3837
if (!$node->name instanceof Node\Identifier) {
@@ -48,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4847
$message = sprintf(
4948
'%s::getMasterRequest() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0 for Symfony 6 compatibility. Use the forward compatibility shim class %s and its getMainRequest() method instead.',
5049
SymfonyRequestStack::class,
51-
DrupalRequestStack::class
50+
'Drupal\Core\Http\RequestStack'
5251
);
5352
return [
5453
RuleErrorBuilder::message($message)

0 commit comments

Comments
 (0)