Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add compatibility to PHP up to 8.3 #21

Merged
merged 8 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 32 additions & 54 deletions .code-quality/ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,48 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer;
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\CodingStandard\Fixer\LineLength\DocBlockLineLengthFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(
Option::PATHS,
return ECSConfig::configure()
->withPaths([
__DIR__ . '/../Classes',
__DIR__ . '/../Tests',
__DIR__ . '/ecs.php',
])
->withSets([
SetList::PSR_12,
SetList::COMMON,
SetList::SYMPLIFY,
SetList::CLEAN_CODE,
])
->withConfiguredRule(
LineLengthFixer::class,
[
__DIR__ . '/../Classes',
__DIR__ . '/ecs.php',
]
);

$containerConfigurator->import(SetList::COMMON);
$containerConfigurator->import(SetList::CLEAN_CODE);
$containerConfigurator->import(SetList::PSR_12);
$containerConfigurator->import(SetList::SYMPLIFY);

$containerConfigurator->services()
->set(LineLengthFixer::class)
->call('configure', [[
LineLengthFixer::LINE_LENGTH => 140,
LineLengthFixer::INLINE_SHORT_LINES => false,
]]);

// Skip Rules and Sniffer
$parameters->set(
Option::SKIP,
[
// Default Skips
Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer::class => [
__DIR__ . '/ecs.php',
],
ArrayListItemNewlineFixer::class => null,
ArrayOpenerAndCloserNewlineFixer::class => null,
ClassAttributesSeparationFixer::class => null,
OrderedImportsFixer::class => null,
NotOperatorWithSuccessorSpaceFixer::class => null,
ExplicitStringVariableFixer::class => null,
ArrayIndentationFixer::class => null,
DocBlockLineLengthFixer::class => null,
'\SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff.DuplicateSpaces' => null,
'\SlevomatCodingStandard\Sniffs\Namespaces\ReferenceUsedNamesOnlySniff.PartialUse' => null,

// @todo for next upgrade
NoSuperfluousPhpdocTagsFixer::class => null,
// @todo strict php
DeclareStrictTypesFixer::class => null,
StrictComparisonFixer::class => null,
StrictParamFixer::class => null,
]
);
};
)
->withSkip([
NotOperatorWithSuccessorSpaceFixer::class => null,
DocBlockLineLengthFixer::class => null,
ArrayListItemNewlineFixer::class => null,
ArrayOpenerAndCloserNewlineFixer::class => null,
FunctionTypehintSpaceFixer::class => [
__DIR__ . '/../Tests/Unit/TYPO3/AdditionalResponseHeadersTest.php',
__DIR__ . '/../Classes/TYPO3/Hooks/ClearCacheMenuHook.php',
__DIR__ . '/../Classes/TYPO3/Configuration/ExtensionConfiguration.php',
],
DeclareStrictTypesFixer::class => null,
GeneralPhpdocAnnotationRemoveFixer::class => null,
hacksch marked this conversation as resolved.
Show resolved Hide resolved
])
->withSpacing(OPTION::INDENTATION_SPACES, "\n");
82 changes: 1 addition & 81 deletions .code-quality/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,82 +1,2 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method object\\:\\:getQueryBuilderForTable\\(\\)\\.$#"
count: 1
path: ../Classes/Domain/Repository/FootnoteRepository.php

-
message: "#^Cannot call method fetchAllAssociative\\(\\) on Doctrine\\\\DBAL\\\\ForwardCompatibility\\\\Result\\|int\\|string\\.$#"
count: 1
path: ../Classes/Domain/Repository/FootnoteRepository.php

-
message: "#^Method AOE\\\\HappyFeet\\\\Domain\\\\Repository\\\\FootnoteRepository\\:\\:getFootnoteByUid\\(\\) should return AOE\\\\HappyFeet\\\\Domain\\\\Model\\\\Footnote\\|null but returns object\\|null\\.$#"
count: 1
path: ../Classes/Domain/Repository/FootnoteRepository.php

-
message: "#^Method AOE\\\\HappyFeet\\\\Service\\\\FCEFootnoteService\\:\\:getCObj\\(\\) should return TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer but returns TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer\\|null\\.$#"
count: 1
path: ../Classes/Service/FCEFootnoteService.php

-
message: "#^Call to an undefined method object\\:\\:setTemplatePathAndFilename\\(\\)\\.$#"
count: 1
path: ../Classes/Service/RenderingService.php

-
message: "#^Method AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\:\\:createView\\(\\) should return TYPO3\\\\CMS\\\\Fluid\\\\View\\\\StandaloneView but returns object\\.$#"
count: 1
path: ../Classes/Service/RenderingService.php

-
message: "#^Method AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\:\\:getContentObjectRenderer\\(\\) should return TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer but returns object\\.$#"
count: 1
path: ../Classes/Service/RenderingService.php

-
message: "#^Parameter \\#1 \\$richText of method AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\:\\:renderRichText\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: ../Classes/Service/RenderingService.php

-
message: "#^Property AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\:\\:\\$contentObjectRenderer \\(TYPO3\\\\CMS\\\\Frontend\\\\ContentObject\\\\ContentObjectRenderer\\|null\\) does not accept object\\.$#"
count: 1
path: ../Classes/Service/RenderingService.php

-
message: "#^Cannot call method renderFootnotes\\(\\) on AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\|null\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkRenderer.php

-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkRenderer.php

-
message: "#^Property AOE\\\\HappyFeet\\\\Typo3\\\\Hook\\\\LinkRenderer\\:\\:\\$renderingService \\(AOE\\\\HappyFeet\\\\Service\\\\RenderingService\\|null\\) does not accept object\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkRenderer.php

-
message: "#^Call to an undefined method TYPO3Fluid\\\\Fluid\\\\View\\\\ViewInterface\\:\\:setTemplate\\(\\)\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkWizzard.php

-
message: "#^Call to an undefined method object\\:\\:asString\\(\\)\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkWizzard.php

-
message: "#^Call to an undefined method object\\:\\:displayRecordsForPage\\(\\)\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkWizzard.php

-
message: "#^Offset 'selector' does not exist on array\\|string\\.$#"
count: 1
path: ../Classes/Typo3/Hook/LinkWizzard.php

ignoreErrors: []
22 changes: 4 additions & 18 deletions .code-quality/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
includes:
- ../.Build/vendor/symplify/phpstan-rules/config/services/services.neon
- phpstan-baseline.neon
- ../.Build/vendor/symplify/phpstan-rules/packages/cognitive-complexity/config/cognitive-complexity-rules.neon

rules:
- Symplify\PHPStanRules\Rules\NoDefaultExceptionRule
- ../.Build/vendor/symplify/phpstan-rules/config/code-complexity-rules.neon

parameters:
level: max
level: 6
paths:
- "../Classes/"

Expand All @@ -15,17 +13,6 @@ parameters:
checkGenericClassInNonGenericObjectType: false

services:
- class: Symplify\Astral\Naming\SimpleNameResolver
- class: Symplify\PHPStanRules\CognitiveComplexity\AstCognitiveComplexityAnalyzer
- class: Symplify\PHPStanRules\CognitiveComplexity\NodeTraverser\ComplexityNodeTraverserFactory
- class: Symplify\PHPStanRules\CognitiveComplexity\DataCollector\CognitiveComplexityDataCollector
- class: Symplify\PHPStanRules\CognitiveComplexity\NodeVisitor\NestingNodeVisitor
- class: Symplify\PHPStanRules\CognitiveComplexity\NodeVisitor\ComplexityNodeVisitor
- class: Symplify\PHPStanRules\CognitiveComplexity\NodeAnalyzer\ComplexityAffectingNodeFinder
- class: Symplify\PackageBuilder\Php\TypeChecker
- class: Symplify\PackageBuilder\Matcher\ArrayStringAndFnMatcher
- class: Symplify\PHPStanRules\TypeAnalyzer\ObjectTypeAnalyzer
- class: Symplify\PHPStanRules\TypeAnalyzer\TypeUnwrapper
-
class: Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule
tags: [phpstan.rules.rule]
Expand All @@ -35,5 +22,4 @@ services:
- dd
- die
- dump
- compact
- var_dump
- compact
30 changes: 0 additions & 30 deletions .code-quality/rector-8_0.php

This file was deleted.

Loading