Skip to content

Commit 364bc2e

Browse files
authored
cleanup CI, add finalise and bump to PHP 8.3 (#915)
* add finalise * bump PHP 8.3 * upgrade syntax to PHP 8.3 * merge reusable to avoid external deps * remove reference
1 parent b821b38 commit 364bc2e

File tree

78 files changed

+372
-715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+372
-715
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,31 @@ jobs:
2020
name: 'Active Classes'
2121
run: vendor/bin/class-leak check config src rules --ansi --skip-suffix "Rector" --skip-type "\Rector\Set\Contract\SetProviderInterface"
2222

23+
-
24+
name: "Finalize Classes"
25+
run: vendor/bin/swiss-knife finalize config src tests rules rules-tests --ansi
26+
27+
-
28+
name: 'Composer Validate'
29+
run: composer validate
30+
31+
-
32+
name: 'PHPStan'
33+
run: vendor/bin/phpstan
34+
2335
name: ${{ matrix.actions.name }}
36+
2437
runs-on: ubuntu-latest
25-
timeout-minutes: 10
38+
39+
timeout-minutes: 5
2640

2741
steps:
2842
- uses: actions/checkout@v4
2943

3044
-
3145
uses: shivammathur/setup-php@v2
3246
with:
33-
php-version: 8.2
47+
php-version: 8.3
3448
coverage: none
3549

3650
- uses: "ramsey/composer-install@v2"

.github/workflows/code_analysis_reusable.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
-
2222
uses: shivammathur/setup-php@v2
2323
with:
24-
php-version: 8.2
24+
php-version: 8.3
2525
coverage: none
2626

2727
- uses: "ramsey/composer-install@v2"

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
"license": "MIT",
55
"description": "Rector upgrades rules for Symfony Framework",
66
"require": {
7-
"php": ">=8.2",
7+
"php": ">=8.3",
88
"ext-xml": "*"
99
},
1010
"require-dev": {
11-
"phpecs/phpecs": "^2.2",
11+
"symplify/easy-coding-standard": "^13.0.4",
1212
"phpstan/extension-installer": "^1.4",
1313
"phpstan/phpstan": "^2.1.32",
1414
"phpstan/phpstan-deprecation-rules": "^2.0",
1515
"phpstan/phpstan-webmozart-assert": "^2.0",
1616
"phpunit/phpunit": "^11.5",
17-
"rector/jack": "^0.4",
17+
"rector/jack": "^0.5",
1818
"rector/rector-src": "dev-main",
19+
"rector/swiss-knife": "^2.3",
1920
"rector/type-perfect": "^2.1",
2021
"symfony/config": "^6.4",
2122
"symfony/dependency-injection": "^6.4",
@@ -30,7 +31,7 @@
3031
"symplify/vendor-patches": "^11.5",
3132
"tomasvotruba/class-leak": "^2.1",
3233
"tomasvotruba/type-coverage": "^2.1",
33-
"tomasvotruba/unused-public": "^2.1",
34+
"tomasvotruba/unused-public": "^2.2",
3435
"tracy/tracy": "^2.11"
3536
},
3637
"autoload": {

phpstan.neon

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# @todo enable
2-
#includes:
3-
# - vendor/symplify/phpstan-rules/config/symplify-rules.neon
4-
# - vendor/symplify/phpstan-rules/config/rector-rules.neon
1+
includes:
2+
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
3+
- vendor/symplify/phpstan-rules/config/rector-rules.neon
54

65
rules:
76
- Symplify\PHPStanRules\Rules\StringFileAbsolutePathExistsRule
@@ -14,7 +13,7 @@ parameters:
1413
typeAliases:
1514
StmtsAware: \PhpParser\Node\Stmt\Block | \PhpParser\Node\Expr\Closure | \PhpParser\Node\Stmt\Case_ | \PhpParser\Node\Stmt\Catch_ | \PhpParser\Node\Stmt\ClassMethod | \PhpParser\Node\Stmt\Do_ | \PhpParser\Node\Stmt\Else_ | \PhpParser\Node\Stmt\ElseIf_ | \PhpParser\Node\Stmt\Finally_ | \PhpParser\Node\Stmt\For_ | \PhpParser\Node\Stmt\Foreach_ | \PhpParser\Node\Stmt\Function_ | \PhpParser\Node\Stmt\If_ | \PhpParser\Node\Stmt\Namespace_ | \PhpParser\Node\Stmt\TryCatch | \PhpParser\Node\Stmt\While_ | \Rector\PhpParser\Node\FileNode
1615

17-
reportUnmatchedIgnoredErrors: false
16+
# reportUnmatchedIgnoredErrors: false
1817
treatPhpDocTypesAsCertain: false
1918

2019
paths:
@@ -50,7 +49,6 @@ parameters:
5049

5150
# false positive
5251
- '#but class PhpParser\\Node\\Stmt\\Expression is not generic#'
53-
- '#Access to an undefined property Rector\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts#'
5452

5553
# more advanced usage, but not always working
5654
# see https://github.com/rectorphp/rector-src/actions/runs/11798721617/job/32865546672?pr=6422#step:5:110
@@ -69,13 +67,21 @@ parameters:
6967

7068
- '#Parameter 1 should use "PHPStan\\BetterReflection\\Reflection\\Adapter\\ReflectionMethod" type as the only type passed to this method#'
7169

72-
# local use php 8.3
73-
- identifier: typeCoverage.constantTypeCoverage
74-
7570
# in tests
7671
-
7772
message: '#Fetching deprecated class constant SYMFONY_(.*?) of class Rector\\Symfony\\Set\\SymfonySetList#'
7873
paths:
7974
- tests
8075
- config/sets/symfony/annotations-to-attributes.php
8176

77+
# using XML to load symfony config
78+
-
79+
path: src/ValueObjectFactory/ServiceMapFactory.php
80+
identifier: rector.noInstanceOfStaticReflection
81+
82+
-
83+
path: src/ValueObjectFactory/ServiceMapFactory.php
84+
message: '#"@simplexml_load_string\(\$fileContents\)" is forbidden to use#'
85+
86+
87+

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
// marked as skipped
3838
ReturnNeverTypeRector::class => ['*/tests/*'],
3939
])
40-
// @todo cleanup rest and move to enum classes ass single place for class names
4140
->withConfiguredRule(StringClassNameToClassConstantRector::class, ['Symfony\*', 'Twig_*', 'Twig*'])
4241
->withPhpSets()
4342
->withPreparedSets(
4443
deadCode: true,
4544
codeQuality: true,
4645
codingStyle: true,
4746
typeDeclarations: true,
47+
typeDeclarationDocblocks: true,
4848
privatization: true,
4949
naming: true,
5050
rectorPreset: true,

rules-tests/CodeQuality/Rector/ClassMethod/ResponseReturnTypeControllerActionRector/Source/CustomObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Rector\Symfony\Tests\CodeQuality\Rector\ClassMethod\ResponseReturnTypeControllerActionRector\Source;
44

5-
class CustomObject
5+
final class CustomObject
66
{
77

88
}

rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Source/IntermediateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Psr\Log\LoggerInterface;
99
use Symfony\Component\Routing\Annotation\Route;
1010

11-
class IntermediateController extends AbstractController
11+
final class IntermediateController extends AbstractController
1212
{
1313
#[Route('/some-action', name: 'some_action')]
1414
public function someAction(LoggerInterface $logger)

rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Source/SomeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
namespace Rector\Symfony\Tests\CodeQuality\Rector\Class_\ControllerMethodInjectionToConstructorRector\Source;
66

77
#[\Attribute]
8-
class SomeType
8+
final class SomeType
99
{
1010
}

rules-tests/CodeQuality/Rector/Class_/ControllerMethodInjectionToConstructorRector/Source/SomeUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
use Symfony\Component\Security\Core\User\UserInterface;
88

9-
class SomeUser implements UserInterface
9+
final class SomeUser implements UserInterface
1010
{
1111
}

0 commit comments

Comments
 (0)