diff --git a/composer.json b/composer.json index efa9972ed..f9899f4ad 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "nette/utils": "^3.2.10 || ^4.0.4", "nikic/php-parser": "^5.7.0", "phpstan/phpstan": "^2.1.34", - "rector/rector": "^2.3.7", + "rector/rector": "^2.4.1", "symfony/console": "^5.4 || ^6.4 || ^7.0", "symfony/filesystem": "^5.4 || ^6.4 || ^7.0", "symfony/finder": "^5.4 || ^6.4 || ^7.0", diff --git a/rules/CodeQuality/General/ConvertImplicitVariablesToExplicitGlobalsRector.php b/rules/CodeQuality/General/ConvertImplicitVariablesToExplicitGlobalsRector.php index 7e4d1a4aa..6fe8c9635 100644 --- a/rules/CodeQuality/General/ConvertImplicitVariablesToExplicitGlobalsRector.php +++ b/rules/CodeQuality/General/ConvertImplicitVariablesToExplicitGlobalsRector.php @@ -87,10 +87,10 @@ private function shouldSkip(Variable $node): bool return false; } - if ($this->filesFinder->isExtLocalConf($this->file->getFilePath())) { + if ($this->filesFinder->isExtLocalConf($this->getFile()->getFilePath())) { return false; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } } diff --git a/rules/CodeQuality/General/MoveExtensionManagementUtilityAddStaticFileIntoTCAOverridesRector.php b/rules/CodeQuality/General/MoveExtensionManagementUtilityAddStaticFileIntoTCAOverridesRector.php index 37a623e0f..3ff866859 100644 --- a/rules/CodeQuality/General/MoveExtensionManagementUtilityAddStaticFileIntoTCAOverridesRector.php +++ b/rules/CodeQuality/General/MoveExtensionManagementUtilityAddStaticFileIntoTCAOverridesRector.php @@ -113,7 +113,7 @@ public function refactor(Node $node) $content = $this->betterStandardPrinter->prettyPrint([$staticMethodCall]) . ';'; - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/sys_template.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, $content . PHP_EOL); @@ -143,6 +143,6 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } } diff --git a/rules/CodeQuality/General/MoveExtensionManagementUtilityAddToAllTCAtypesIntoTCAOverridesRector.php b/rules/CodeQuality/General/MoveExtensionManagementUtilityAddToAllTCAtypesIntoTCAOverridesRector.php index da1669471..4e70ad627 100644 --- a/rules/CodeQuality/General/MoveExtensionManagementUtilityAddToAllTCAtypesIntoTCAOverridesRector.php +++ b/rules/CodeQuality/General/MoveExtensionManagementUtilityAddToAllTCAtypesIntoTCAOverridesRector.php @@ -118,7 +118,7 @@ public function refactor(Node $node) $content = $this->betterStandardPrinter->prettyPrint([$staticMethodCall]) . ';'; - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/' . $tableNameAsString . '.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, $content . PHP_EOL); @@ -148,7 +148,7 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } /** diff --git a/rules/CodeQuality/General/MoveExtensionUtilityRegisterPluginIntoTCAOverridesRector.php b/rules/CodeQuality/General/MoveExtensionUtilityRegisterPluginIntoTCAOverridesRector.php index ef842e0ec..f4cf87d4c 100644 --- a/rules/CodeQuality/General/MoveExtensionUtilityRegisterPluginIntoTCAOverridesRector.php +++ b/rules/CodeQuality/General/MoveExtensionUtilityRegisterPluginIntoTCAOverridesRector.php @@ -113,7 +113,7 @@ public function refactor(Node $node) $content = $this->betterStandardPrinter->prettyPrint([$staticMethodCall]) . ';'; - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/tt_content.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, $content . PHP_EOL); @@ -143,6 +143,6 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } } diff --git a/rules/TYPO310/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php b/rules/TYPO310/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php index a55c4e58d..79c486b41 100644 --- a/rules/TYPO310/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php +++ b/rules/TYPO310/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php @@ -82,7 +82,7 @@ public function refactor(Node $node): ?Node $extensionName = $this->valueResolver->getValue($extensionNameArgumentValue); - $fileInfo = $this->fileInfoFactory->createFileInfoFromPath($this->file->getFilePath()); + $fileInfo = $this->fileInfoFactory->createFileInfoFromPath($this->getFile()->getFilePath()); if ($extensionNameArgumentValue instanceof Concat && $this->isPotentiallyUndefinedExtensionKeyVariable($extensionNameArgumentValue) diff --git a/rules/TYPO310/v1/RegisterPluginWithVendorNameRector.php b/rules/TYPO310/v1/RegisterPluginWithVendorNameRector.php index 75ba654fa..b883f67e3 100644 --- a/rules/TYPO310/v1/RegisterPluginWithVendorNameRector.php +++ b/rules/TYPO310/v1/RegisterPluginWithVendorNameRector.php @@ -98,7 +98,7 @@ private function removeVendorNameIfNeeded(StaticCall $staticCall): ?Node $extensionName = $this->valueResolver->getValue($extensionNameArgumentValue); - $fileInfo = $this->fileInfoFactory->createFileInfoFromPath($this->file->getFilePath()); + $fileInfo = $this->fileInfoFactory->createFileInfoFromPath($this->getFile()->getFilePath()); if ($extensionNameArgumentValue instanceof Concat && $this->isPotentiallyUndefinedExtensionKeyVariable($extensionNameArgumentValue) diff --git a/rules/TYPO311/v0/SubstituteConstantsModeAndRequestTypeRector.php b/rules/TYPO311/v0/SubstituteConstantsModeAndRequestTypeRector.php index 9eddd14da..0b16e7d17 100644 --- a/rules/TYPO311/v0/SubstituteConstantsModeAndRequestTypeRector.php +++ b/rules/TYPO311/v0/SubstituteConstantsModeAndRequestTypeRector.php @@ -310,7 +310,7 @@ private function createIsCliCall(): StaticCall private function shouldSkip(): bool { - $filePath = $this->file->getFilePath(); + $filePath = $this->getFile()->getFilePath(); if ($this->filesFinder->isExtLocalConf($filePath)) { return true; } diff --git a/rules/TYPO311/v2/MigrateFrameModuleToSvgTreeRector.php b/rules/TYPO311/v2/MigrateFrameModuleToSvgTreeRector.php index 2bf50e93d..00ee8b4a6 100644 --- a/rules/TYPO311/v2/MigrateFrameModuleToSvgTreeRector.php +++ b/rules/TYPO311/v2/MigrateFrameModuleToSvgTreeRector.php @@ -102,7 +102,7 @@ public function getRuleDefinition(): RuleDefinition private function shouldSkip(Node $node): bool { if (! $this->filesFinder->isExtTables( - $this->file->getFilePath() + $this->getFile()->getFilePath() ) && ! StaticPHPUnitEnvironment::isPHPUnitRun()) { return true; } diff --git a/rules/TYPO311/v4/RegisterIconToIconFileRector.php b/rules/TYPO311/v4/RegisterIconToIconFileRector.php index b83aa36e7..9637190f6 100644 --- a/rules/TYPO311/v4/RegisterIconToIconFileRector.php +++ b/rules/TYPO311/v4/RegisterIconToIconFileRector.php @@ -167,7 +167,7 @@ public function refactor(Node $node): ?int [$iconIdentifierString, $innerItems] = $this->createNewIconArray($methodCall); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $iconsFilePath = $directoryName . '/Configuration/Icons.php'; $newContent = $this->addNewIconToIconsFile($iconsFilePath, $iconIdentifierString, $innerItems); @@ -195,7 +195,7 @@ private function shouldSkip(MethodCall $methodCall): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } /** diff --git a/rules/TYPO312/v0/MigrateBackendModuleRegistrationRector.php b/rules/TYPO312/v0/MigrateBackendModuleRegistrationRector.php index dc0c1caf3..37cb1d74c 100644 --- a/rules/TYPO312/v0/MigrateBackendModuleRegistrationRector.php +++ b/rules/TYPO312/v0/MigrateBackendModuleRegistrationRector.php @@ -192,7 +192,7 @@ public function refactor(Node $node): ?int $content = ArrayUtility::arrayExport($returnArray); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/Backend/Modules.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { @@ -259,7 +259,7 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } /** diff --git a/rules/TYPO312/v0/MoveAllowTableOnStandardPagesToTCAConfigurationRector.php b/rules/TYPO312/v0/MoveAllowTableOnStandardPagesToTCAConfigurationRector.php index 9f2a82987..05dd1a086 100644 --- a/rules/TYPO312/v0/MoveAllowTableOnStandardPagesToTCAConfigurationRector.php +++ b/rules/TYPO312/v0/MoveAllowTableOnStandardPagesToTCAConfigurationRector.php @@ -96,7 +96,7 @@ public function refactor(Node $node) continue; } - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/' . $tableName . '.php'; $this->writeConfigurationToFile($newConfigurationFile, $tableName); } @@ -117,7 +117,7 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } private function writeConfigurationToFile(string $newConfigurationFile, string $tableName): void diff --git a/rules/TYPO313/v0/MigrateAddPageTSConfigToPageTsConfigFileRector.php b/rules/TYPO313/v0/MigrateAddPageTSConfigToPageTsConfigFileRector.php index 5a8670df8..9b8dc0654 100644 --- a/rules/TYPO313/v0/MigrateAddPageTSConfigToPageTsConfigFileRector.php +++ b/rules/TYPO313/v0/MigrateAddPageTSConfigToPageTsConfigFileRector.php @@ -110,7 +110,7 @@ public function refactor(Node $node) $this->resolvePotentialExtensionKeyByConcatenation($contentArgumentValue); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $content = $this->valueResolver->getValue($contentArgumentValue); $newConfigurationFile = $directoryName . '/Configuration/page.tsconfig'; @@ -144,6 +144,6 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } } diff --git a/rules/TYPO313/v0/MigrateAddUserTSConfigToUserTsConfigFileRector.php b/rules/TYPO313/v0/MigrateAddUserTSConfigToUserTsConfigFileRector.php index 33d6e1515..5c1cd579d 100644 --- a/rules/TYPO313/v0/MigrateAddUserTSConfigToUserTsConfigFileRector.php +++ b/rules/TYPO313/v0/MigrateAddUserTSConfigToUserTsConfigFileRector.php @@ -110,7 +110,7 @@ public function refactor(Node $node) $this->resolvePotentialExtensionKeyByConcatenation($contentArgumentValue); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $content = $this->valueResolver->getValue($contentArgumentValue); $newConfigurationFile = $directoryName . '/Configuration/user.tsconfig'; @@ -144,6 +144,6 @@ private function shouldSkip(StaticCall $staticMethodCall): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } } diff --git a/rules/TYPO313/v1/RenamePageTreeNavigationComponentIdRector.php b/rules/TYPO313/v1/RenamePageTreeNavigationComponentIdRector.php index 586b3e340..4d155cc61 100644 --- a/rules/TYPO313/v1/RenamePageTreeNavigationComponentIdRector.php +++ b/rules/TYPO313/v1/RenamePageTreeNavigationComponentIdRector.php @@ -63,7 +63,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - if ($this->shouldSkip($this->file->getFilePath(), $node)) { + if ($this->shouldSkip($this->getFile()->getFilePath(), $node)) { return null; } diff --git a/rules/TYPO313/v2/MigrateTableDependentDefinitionOfColumnsOnlyRector.php b/rules/TYPO313/v2/MigrateTableDependentDefinitionOfColumnsOnlyRector.php index 1db585ad4..81cb88bbc 100644 --- a/rules/TYPO313/v2/MigrateTableDependentDefinitionOfColumnsOnlyRector.php +++ b/rules/TYPO313/v2/MigrateTableDependentDefinitionOfColumnsOnlyRector.php @@ -6,7 +6,6 @@ use PhpParser\Node; use PhpParser\Node\ArrayItem; -use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; @@ -118,7 +117,6 @@ public function refactor(Node $node): ?Node return null; } - /** @var Expr $originalColumnsOnlyValueNode */ $originalColumnsOnlyValueNode = $columnsOnlyItemNode->value; $innerArrayItems = []; diff --git a/rules/TYPO313/v3/UseTYPO3CoreViewInterfaceInExtbaseRector.php b/rules/TYPO313/v3/UseTYPO3CoreViewInterfaceInExtbaseRector.php index d8e102e32..035404395 100644 --- a/rules/TYPO313/v3/UseTYPO3CoreViewInterfaceInExtbaseRector.php +++ b/rules/TYPO313/v3/UseTYPO3CoreViewInterfaceInExtbaseRector.php @@ -257,7 +257,6 @@ private function shouldSkip(MethodCall $methodCall): bool { // Ensure the call is on $this->view or a variable of the correct type if ($methodCall->var instanceof PropertyFetch) { - /** @var PropertyFetch $propertyFetch */ $propertyFetch = $methodCall->var; // Not $this->view, check if it's another variable of the correct type if ((! $this->isName($propertyFetch->var, 'this') || ! $this->isName( diff --git a/rules/TYPO313/v4/MigratePluginContentElementAndPluginSubtypesRector.php b/rules/TYPO313/v4/MigratePluginContentElementAndPluginSubtypesRector.php index cddfcbbf8..28c6ab940 100644 --- a/rules/TYPO313/v4/MigratePluginContentElementAndPluginSubtypesRector.php +++ b/rules/TYPO313/v4/MigratePluginContentElementAndPluginSubtypesRector.php @@ -120,9 +120,9 @@ public function refactor(Node $node): ?Node } } - $psr4 = $this->composerPsr4Resolver->resolve($this->file); + $psr4 = $this->composerPsr4Resolver->resolve($this->getFile()); if ($psr4 !== null) { - $filePath = $this->file->getFilePath(); + $filePath = $this->getFile()->getFilePath(); $directoryName = $this->filesFinder->isInTCAOverridesFolder($filePath) ? dirname($filePath, 4) : dirname($filePath); diff --git a/rules/TYPO314/v0/MigrateFileCollectionRegistryAddTypeToTCARector.php b/rules/TYPO314/v0/MigrateFileCollectionRegistryAddTypeToTCARector.php index 840fb9c1f..82d925500 100644 --- a/rules/TYPO314/v0/MigrateFileCollectionRegistryAddTypeToTCARector.php +++ b/rules/TYPO314/v0/MigrateFileCollectionRegistryAddTypeToTCARector.php @@ -136,7 +136,7 @@ public function refactor(Node $node): ?int $content = $this->prettyTypo3Printer->prettyPrint($newNodes); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/sys_file_collection.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { @@ -223,6 +223,6 @@ private function shouldSkip(MethodCall $methodCall): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } } diff --git a/rules/TYPO314/v0/MigrateGeneralUtilityCreateVersionNumberedFilenameRector.php b/rules/TYPO314/v0/MigrateGeneralUtilityCreateVersionNumberedFilenameRector.php index 10e169068..3f0356946 100644 --- a/rules/TYPO314/v0/MigrateGeneralUtilityCreateVersionNumberedFilenameRector.php +++ b/rules/TYPO314/v0/MigrateGeneralUtilityCreateVersionNumberedFilenameRector.php @@ -200,9 +200,10 @@ public function refactor(Node $node): ?Node $finalStmt = new Return_($replacementNode, [ AttributeKey::COMMENTS => $comments, ]); + } elseif (! $assignNode instanceof Assign) { + return null; } else { // Re-use the original variable for assignment - /** @var Assign $assignNode */ $uriAssign = new Assign($assignNode->var, $replacementNode); $finalStmt = new Expression($uriAssign, [ AttributeKey::COMMENTS => $comments, diff --git a/rules/TYPO314/v0/MigrateIpAnonymizationTaskRector.php b/rules/TYPO314/v0/MigrateIpAnonymizationTaskRector.php index 6fd99a66f..ab7782490 100644 --- a/rules/TYPO314/v0/MigrateIpAnonymizationTaskRector.php +++ b/rules/TYPO314/v0/MigrateIpAnonymizationTaskRector.php @@ -241,7 +241,7 @@ private function shouldSkip(Expression $node): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } private function createNewAssignmentTarget(Expr $classConstFetch): ArrayDimFetch @@ -264,7 +264,7 @@ private function writeStatementToFile(If_ $ifStatement): void { $content = $this->printer->prettyPrint([$ifStatement]); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/tx_scheduler_task.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, PHP_EOL . $content . PHP_EOL); diff --git a/rules/TYPO314/v0/MigratePathUtilityGetPublicResourceWebPathRector.php b/rules/TYPO314/v0/MigratePathUtilityGetPublicResourceWebPathRector.php index e8a8483cb..e5604aac5 100644 --- a/rules/TYPO314/v0/MigratePathUtilityGetPublicResourceWebPathRector.php +++ b/rules/TYPO314/v0/MigratePathUtilityGetPublicResourceWebPathRector.php @@ -185,9 +185,10 @@ public function refactor(Node $node): ?Node // Reconstruct the original statement type (Return or Assignment) if ($isReturn) { $finalStmt = new Return_($replacementNode); + } elseif (! $assignNode instanceof Assign) { + return null; } else { // Re-use the original variable for assignment - /** @var Assign $assignNode */ $uriAssign = new Assign($assignNode->var, $replacementNode); $finalStmt = new Expression($uriAssign); } diff --git a/rules/TYPO314/v0/MigrateTableGarbageCollectionTaskConfigurationViaGlobalsRector.php b/rules/TYPO314/v0/MigrateTableGarbageCollectionTaskConfigurationViaGlobalsRector.php index 8280fca2d..18eba8d1b 100644 --- a/rules/TYPO314/v0/MigrateTableGarbageCollectionTaskConfigurationViaGlobalsRector.php +++ b/rules/TYPO314/v0/MigrateTableGarbageCollectionTaskConfigurationViaGlobalsRector.php @@ -238,7 +238,7 @@ private function shouldSkip(Expression $node): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } private function createNewAssignmentTarget(Expr $classConstFetch): ArrayDimFetch @@ -261,7 +261,7 @@ private function writeStatementToFile(If_ $ifStatement): void { $content = $this->printer->prettyPrint([$ifStatement]); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/tx_scheduler_task.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, PHP_EOL . $content . PHP_EOL); diff --git a/rules/TYPO314/v0/MoveSchedulerFrequencyOptionsToTCARector.php b/rules/TYPO314/v0/MoveSchedulerFrequencyOptionsToTCARector.php index ef55be564..e80bf2850 100644 --- a/rules/TYPO314/v0/MoveSchedulerFrequencyOptionsToTCARector.php +++ b/rules/TYPO314/v0/MoveSchedulerFrequencyOptionsToTCARector.php @@ -179,7 +179,7 @@ private function shouldSkip(Expression $node): bool return true; } - return ! $this->filesFinder->isExtLocalConf($this->file->getFilePath()); + return ! $this->filesFinder->isExtLocalConf($this->getFile()->getFilePath()); } private function createNewAssignmentTarget(): ArrayDimFetch @@ -201,7 +201,7 @@ private function writeStatementToFile(Expression $expression): void { $content = $this->printer->prettyPrint([$expression]); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/tx_scheduler_task.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { $this->filesystem->appendToFile($newConfigurationFile, PHP_EOL . $content . PHP_EOL); diff --git a/rules/TYPO314/v0/RequireComposerJsonInClassicModeRector.php b/rules/TYPO314/v0/RequireComposerJsonInClassicModeRector.php index 38d0d8b87..eeb345255 100644 --- a/rules/TYPO314/v0/RequireComposerJsonInClassicModeRector.php +++ b/rules/TYPO314/v0/RequireComposerJsonInClassicModeRector.php @@ -94,7 +94,7 @@ public function refactor(Node $node): ?Node } // Determine the extension root directory and key - $directory = dirname($this->file->getFilePath()); + $directory = dirname($this->getFile()->getFilePath()); $composerJsonPath = $directory . '/composer.json'; if ($this->filesystem->fileExists($composerJsonPath)) { @@ -278,7 +278,7 @@ public function refactor(Node $node): ?Node private function shouldSkip(Assign $node): bool { - if (! $this->filesFinder->isExtEmConf($this->file->getFilePath())) { + if (! $this->filesFinder->isExtEmConf($this->getFile()->getFilePath())) { return true; } diff --git a/rules/TYPO314/v2/MigrateTcaOptionAllowedRecordTypesForPageTypesRector.php b/rules/TYPO314/v2/MigrateTcaOptionAllowedRecordTypesForPageTypesRector.php index e591a8411..b5f078081 100644 --- a/rules/TYPO314/v2/MigrateTcaOptionAllowedRecordTypesForPageTypesRector.php +++ b/rules/TYPO314/v2/MigrateTcaOptionAllowedRecordTypesForPageTypesRector.php @@ -135,7 +135,7 @@ public function refactor(Node $node): ?int $allowedRecordTypesString ); - $directoryName = dirname($this->file->getFilePath()); + $directoryName = dirname($this->getFile()->getFilePath()); $newConfigurationFile = $directoryName . '/Configuration/TCA/Overrides/pages.php'; if ($this->filesystem->fileExists($newConfigurationFile)) { @@ -170,6 +170,6 @@ private function shouldSkip(MethodCall $methodCall): bool return true; } - return ! $this->filesFinder->isExtTables($this->file->getFilePath()); + return ! $this->filesFinder->isExtTables($this->getFile()->getFilePath()); } } diff --git a/src/Helper/ExtensionKeyResolverTrait.php b/src/Helper/ExtensionKeyResolverTrait.php index 9d7102494..2f068e36e 100644 --- a/src/Helper/ExtensionKeyResolverTrait.php +++ b/src/Helper/ExtensionKeyResolverTrait.php @@ -29,7 +29,7 @@ private function resolvePotentialExtensionKeyByExtensionKeyParameter($contentArg return null; } - $resolvedExtensionKey = $this->composerExtensionKeyResolver->resolveExtensionKey($this->file); + $resolvedExtensionKey = $this->composerExtensionKeyResolver->resolveExtensionKey($this->getFile()); if ($resolvedExtensionKey === null) { return null; } @@ -60,7 +60,7 @@ private function resolvePotentialExtensionKeyByConcatenation($contentArgumentVal return; } - $resolvedExtensionKey = $this->composerExtensionKeyResolver->resolveExtensionKey($this->file); + $resolvedExtensionKey = $this->composerExtensionKeyResolver->resolveExtensionKey($this->getFile()); if ($resolvedExtensionKey === null) { return; }