Skip to content

Commit

Permalink
✨ add php8.3 compat (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti authored Nov 3, 2023
1 parent d7ee386 commit b68c5f6
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 15 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/run-grumphp-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ name: Run grumphp with different versions
on: [push]
jobs:
test:
name: "php: ${{ matrix.php }} TYPO3: ${{ matrix.typo3 }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
php: ['8.1', '8.2', '8.3-rc']
typo3: [false, true]
container:
image: kanti/buildy:${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- run: composer install --no-progress --no-scripts -n
- run: git config --global --add safe.directory /__w/grumphp-config/grumphp-config
- run: |
composer install --no-progress --no-scripts -n --ignore-platform-req=php+ \
&& mv phpstan-baseline-without-typo3.neon phpstan-baseline.neon
if: ${{ ! matrix.typo3 }}
- run: composer req saschaegerer/phpstan-typo3 ssch/typo3-rector --no-progress --no-scripts -n --ignore-platform-req=php+
if: ${{ matrix.typo3 }}

- run: ./vendor/bin/grumphp run
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"issues": "https://github.com/pluswerk/grumphp-config/issues"
},
"require": {
"php": "~8.1.0 || ~8.2.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"composer-plugin-api": "^2.1.0",
"andersundsehr/phpstan-git-files": "^1.0.1",
"composer/semver": "^3.3.0",
Expand All @@ -38,9 +38,7 @@
"composer/composer": "^2.5.5",
"pluswerk/grumphp-bom-task": "dev-main as 8.99.99",
"pluswerk/grumphp-xliff-task": "dev-main as 6.99.99",
"roave/security-advisories": "dev-latest",
"saschaegerer/phpstan-typo3": "^1.8.5",
"ssch/typo3-rector": "^1.3.5"
"roave/security-advisories": "dev-latest"
},
"repositories": [
{
Expand All @@ -58,16 +56,16 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"phpro/grumphp": true,
"phpstan/extension-installer": true,
"typo3/cms-composer-installers": true,
"typo3/class-alias-loader": true,
"ergebnis/composer-normalize": true
"typo3/cms-composer-installers": true
},
"preferred-install": {
"andersundsehr/phpstan-git-files": "source",
"pluswerk/grumphp-bom-task": "source",
"pluswerk/grumphp-xliff-task": "source",
"andersundsehr/phpstan-git-files": "source",
"*": "dist"
},
"sort-packages": true
Expand Down
76 changes: 76 additions & 0 deletions phpstan-baseline-without-typo3.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
parameters:
ignoreErrors:
-
message: "#^Class Ssch\\\\TYPO3Rector\\\\Rector\\\\General\\\\ConvertImplicitVariablesToExplicitGlobalsRector not found\\.$#"
count: 1
path: rector-typo3-rule-set.php

-
message: "#^Parameter \\#1 \\$rectorClasses of method Rector\\\\Config\\\\RectorConfig\\:\\:rules\\(\\) expects array\\<class\\-string\\<Rector\\\\Core\\\\Contract\\\\Rector\\\\RectorInterface\\>\\>, array\\<int, string\\> given\\.$#"
count: 1
path: rector-typo3-rule-set.php

-
message: "#^Access to constant TYPO3_104 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant TYPO3_11 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant TYPO3_12 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant TYPO3_76 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant TYPO3_87 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant TYPO3_95 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3SetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_10 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_11 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_12 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_7 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_8 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Access to constant UP_TO_TYPO3_9 on an unknown class Ssch\\\\TYPO3Rector\\\\Set\\\\Typo3LevelSetList\\.$#"
count: 1
path: src/RectorSettings.php

-
message: "#^Class Ssch\\\\TYPO3Rector\\\\Rector\\\\Migrations\\\\RenameClassMapAliasRector not found\\.$#"
count: 1
path: src/RectorSettings.php
4 changes: 4 additions & 0 deletions rector-typo3-rule-set.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
if (!class_exists(InjectMethodToConstructorInjectionRector::class)) {
return;
}

$rectorConfig->rules(
[
InjectMethodToConstructorInjectionRector::class,
Expand Down
8 changes: 4 additions & 4 deletions src/RectorSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function sets(bool $entirety = false): array
//SetList::PHP_81, // YES, included in LevelSetList::class . '::UP_TO_PHP_' ...
//SetList::PHP_82, // YES, included in LevelSetList::class . '::UP_TO_PHP_' ...
SetList::PRIVATIZATION, // some things may be bad
$entirety ? SetList::PSR_4 : null,
SetList::TYPE_DECLARATION, // YES
SetList::EARLY_RETURN, //YES
SetList::INSTANCEOF,
Expand Down Expand Up @@ -123,7 +122,7 @@ public static function setsTypo3(bool $entirety = false): array
*/
public static function skip(): array
{
return [
return array_filter([
/**
* FROM: if($object) {
* TO: if($object !== null) {
Expand Down Expand Up @@ -202,9 +201,10 @@ public static function skip(): array
TypedPropertyFromStrictGetterMethodReturnTypeRector::class,
/**
* perfomance issues in many projects
* @deprecated remove if rector 0.17.0 is not supported anymore:
*/
RemoveEmptyMethodCallRector::class,
];
class_exists(RemoveEmptyMethodCallRector::class) ? RemoveEmptyMethodCallRector::class : null,
]);
}

/**
Expand Down

0 comments on commit b68c5f6

Please sign in to comment.