From 60e6d5f13f2e756319fb0323dd720aff0fe5da70 Mon Sep 17 00:00:00 2001 From: Sebastian Schreiber Date: Wed, 24 Jan 2024 15:48:57 +0100 Subject: [PATCH 1/2] BUGFIX: Fix missing removal Resolves: #3240 --- .../Rector/v7/v6/RenderTypeFlexFormRector.php | 8 ++++---- .../Conditions/GlobalVarConditionMatcher.php | 20 +++++++++---------- ...odeMethodsFromTypo3QuerySettingsRector.php | 2 +- .../Generic/QuerySettingsInterface.php | 4 ++++ .../Generic/Typo3QuerySettings.php | 2 +- .../remove_language_mode_methods.php.inc | 1 + 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php index f40b31ca4..8eda81dec 100644 --- a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php +++ b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php @@ -90,16 +90,16 @@ protected function refactorColumn(?DOMElement $configElement): void if ($renderModeDomElement instanceof DOMElement) { $renderMode = $renderModeDomElement->nodeValue; switch ($renderMode) { - case 'tree': + case 'tree' : $renderTypeName = 'selectTree'; break; - case 'singlebox': + case 'singlebox' : $renderTypeName = 'selectSingleBox'; break; - case 'checkbox': + case 'checkbox' : $renderTypeName = 'selectCheckBox'; break; - default: + default : $renderTypeName = null; } diff --git a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php index 03f0831c2..ef9130cbe 100644 --- a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php @@ -53,34 +53,34 @@ public function change(string $condition): ?string } switch ($type) { - case 'TSFE': + case 'TSFE' : $conditions[$key][] = $this->refactorTsfe($property, $operator, $value); break; - case 'GP': + case 'GP' : $conditions[$key][] = $this->refactorGetPost($property, $operator, $value); break; - case 'LIT': + case 'LIT' : $conditions[$key][] = sprintf('"%s" %s "%s"', $value, self::OPERATOR_MAPPING[$operator], $property); break; - case 'ENV': + case 'ENV' : $conditions[$key][] = $this->createEnvCondition($property, $operator, $value); break; - case 'IENV': + case 'IENV' : $conditions[$key][] = $this->createIndependentCondition($property, $operator, $value); break; - case 'BE_USER': + case 'BE_USER' : $conditions[$key][] = $this->createBackendUserCondition($property, $operator, $value); break; - case '_GET': + case '_GET' : $conditions[$key][] = $this->refactorGet($property, $operator, $value); break; - case 'GPmerged': + case 'GPmerged' : $conditions[$key][] = $this->refactorGetPost($property, $operator, $value); break; - case '_POST': + case '_POST' : $conditions[$key][] = $this->refactorPost($property, $operator, $value); break; - default: + default : $conditions[$key][] = $condition; break; } diff --git a/src/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector.php b/src/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector.php index 17876aa68..fd59ffbcf 100644 --- a/src/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector.php +++ b/src/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector.php @@ -53,7 +53,7 @@ public function refactor(Node $node): ?Node { if (! $this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType( $node, - new ObjectType('TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings') + new ObjectType('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface') )) { return null; } diff --git a/stubs/TYPO3/CMS/Extbase/Persistence/Generic/QuerySettingsInterface.php b/stubs/TYPO3/CMS/Extbase/Persistence/Generic/QuerySettingsInterface.php index ad22ce3ca..29a2eb742 100644 --- a/stubs/TYPO3/CMS/Extbase/Persistence/Generic/QuerySettingsInterface.php +++ b/stubs/TYPO3/CMS/Extbase/Persistence/Generic/QuerySettingsInterface.php @@ -4,6 +4,10 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic; +if (interface_exists('TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface')) { + return; +} + interface QuerySettingsInterface { diff --git a/stubs/TYPO3/CMS/Extbase/Persistence/Generic/Typo3QuerySettings.php b/stubs/TYPO3/CMS/Extbase/Persistence/Generic/Typo3QuerySettings.php index cf9036a05..9caf21a1c 100644 --- a/stubs/TYPO3/CMS/Extbase/Persistence/Generic/Typo3QuerySettings.php +++ b/stubs/TYPO3/CMS/Extbase/Persistence/Generic/Typo3QuerySettings.php @@ -5,7 +5,7 @@ return; } -class Typo3QuerySettings +class Typo3QuerySettings implements QuerySettingsInterface { /** * @var int diff --git a/tests/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector/Fixture/remove_language_mode_methods.php.inc b/tests/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector/Fixture/remove_language_mode_methods.php.inc index 3a1414d7a..3d8fd66cb 100644 --- a/tests/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector/Fixture/remove_language_mode_methods.php.inc +++ b/tests/Rector/v11/v0/RemoveLanguageModeMethodsFromTypo3QuerySettingsRector/Fixture/remove_language_mode_methods.php.inc @@ -8,6 +8,7 @@ $querySettings = new Typo3QuerySettings(); $querySettings->setLanguageMode(); $querySettings->setLanguageMode()->setLanguageUid(0); $querySettings->setLanguageUid(0)->setLanguageMode()->getLanguageMode(); +$querySettings->setLanguageMode('ignore'); ?> ----- From cf68c6b100fdc9c0050cb8736cd457803184bd3d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 24 Jan 2024 14:50:23 +0000 Subject: [PATCH 2/2] [CI] Rector Rectify --- .../Rector/v7/v6/RenderTypeFlexFormRector.php | 8 ++++---- .../Conditions/GlobalVarConditionMatcher.php | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php index 8eda81dec..f40b31ca4 100644 --- a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php +++ b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php @@ -90,16 +90,16 @@ protected function refactorColumn(?DOMElement $configElement): void if ($renderModeDomElement instanceof DOMElement) { $renderMode = $renderModeDomElement->nodeValue; switch ($renderMode) { - case 'tree' : + case 'tree': $renderTypeName = 'selectTree'; break; - case 'singlebox' : + case 'singlebox': $renderTypeName = 'selectSingleBox'; break; - case 'checkbox' : + case 'checkbox': $renderTypeName = 'selectCheckBox'; break; - default : + default: $renderTypeName = null; } diff --git a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php index ef9130cbe..03f0831c2 100644 --- a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php @@ -53,34 +53,34 @@ public function change(string $condition): ?string } switch ($type) { - case 'TSFE' : + case 'TSFE': $conditions[$key][] = $this->refactorTsfe($property, $operator, $value); break; - case 'GP' : + case 'GP': $conditions[$key][] = $this->refactorGetPost($property, $operator, $value); break; - case 'LIT' : + case 'LIT': $conditions[$key][] = sprintf('"%s" %s "%s"', $value, self::OPERATOR_MAPPING[$operator], $property); break; - case 'ENV' : + case 'ENV': $conditions[$key][] = $this->createEnvCondition($property, $operator, $value); break; - case 'IENV' : + case 'IENV': $conditions[$key][] = $this->createIndependentCondition($property, $operator, $value); break; - case 'BE_USER' : + case 'BE_USER': $conditions[$key][] = $this->createBackendUserCondition($property, $operator, $value); break; - case '_GET' : + case '_GET': $conditions[$key][] = $this->refactorGet($property, $operator, $value); break; - case 'GPmerged' : + case 'GPmerged': $conditions[$key][] = $this->refactorGetPost($property, $operator, $value); break; - case '_POST' : + case '_POST': $conditions[$key][] = $this->refactorPost($property, $operator, $value); break; - default : + default: $conditions[$key][] = $condition; break; }