diff --git a/src/FileProcessor/FlexForms/FlexFormsProcessor.php b/src/FileProcessor/FlexForms/FlexFormsProcessor.php index 43256e5ac..8d0642cab 100644 --- a/src/FileProcessor/FlexForms/FlexFormsProcessor.php +++ b/src/FileProcessor/FlexForms/FlexFormsProcessor.php @@ -65,7 +65,7 @@ public function process(File $file, Configuration $configuration): array } $xml = $domDocument->saveXML($domDocument->documentElement, LIBXML_NOEMPTYTAG); - if (false === $xml) { + if ($xml === false) { throw new UnexpectedValueException('Could not convert to xml'); } @@ -89,7 +89,7 @@ public function process(File $file, Configuration $configuration): array public function supports(File $file, Configuration $configuration): bool { // avoid empty run - if ([] === $this->flexFormRectors) { + if ($this->flexFormRectors === []) { return false; } @@ -107,11 +107,11 @@ public function supports(File $file, Configuration $configuration): bool return false; } - if (false === $xml) { + if ($xml === false) { return false; } - return 'T3DataStructure' === $xml->getName(); + return $xml->getName() === 'T3DataStructure'; } /** diff --git a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php index f164e7d6b..a2f17d478 100644 --- a/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php +++ b/src/FileProcessor/FlexForms/Rector/v7/v6/RenderTypeFlexFormRector.php @@ -36,7 +36,7 @@ public function transform(DOMDocument $domDocument): bool continue; } - if ('select' !== $type->textContent) { + if ($type->textContent !== 'select') { continue; } diff --git a/src/FileProcessor/Fluid/FluidFileProcessor.php b/src/FileProcessor/Fluid/FluidFileProcessor.php index 7299e8068..60826eab3 100644 --- a/src/FileProcessor/Fluid/FluidFileProcessor.php +++ b/src/FileProcessor/Fluid/FluidFileProcessor.php @@ -38,7 +38,7 @@ public function __construct(array $fluidRectors, FileDiffFactory $fileDiffFactor public function supports(File $file, Configuration $configuration): bool { - if ([] === $this->fluidRectors) { + if ($this->fluidRectors === []) { return false; } diff --git a/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameConstantsAndSetupFileEndingRector.php b/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameConstantsAndSetupFileEndingRector.php index 0fc181b44..0a38719c0 100644 --- a/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameConstantsAndSetupFileEndingRector.php +++ b/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameConstantsAndSetupFileEndingRector.php @@ -82,11 +82,11 @@ private function shouldSkip(File $file): bool return true; } - if ('constants.txt' === $smartFileInfo->getBasename()) { + if ($smartFileInfo->getBasename() === 'constants.txt') { return false; } - return 'setup.txt' !== $smartFileInfo->getBasename(); + return $smartFileInfo->getBasename() !== 'setup.txt'; } private function shouldSkipInTestMode(SmartFileInfo $smartFileInfo): bool diff --git a/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameExtTypoScriptFilesFileRector.php b/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameExtTypoScriptFilesFileRector.php index 654486550..3578842b7 100644 --- a/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameExtTypoScriptFilesFileRector.php +++ b/src/FileProcessor/Resources/Files/Rector/v12/v0/RenameExtTypoScriptFilesFileRector.php @@ -81,11 +81,11 @@ private function shouldSkip(File $file): bool return true; } - if ('ext_typoscript_setup.txt' === $smartFileInfo->getBasename()) { + if ($smartFileInfo->getBasename() === 'ext_typoscript_setup.txt') { return false; } - if ('ext_typoscript_constants.txt' === $smartFileInfo->getBasename()) { + if ($smartFileInfo->getBasename() === 'ext_typoscript_constants.txt') { return false; } diff --git a/src/FileProcessor/Resources/Icons/IconsFileProcessor.php b/src/FileProcessor/Resources/Icons/IconsFileProcessor.php index a6ca6d237..b03173401 100644 --- a/src/FileProcessor/Resources/Icons/IconsFileProcessor.php +++ b/src/FileProcessor/Resources/Icons/IconsFileProcessor.php @@ -103,6 +103,6 @@ private function shouldSkip(string $filenameWithoutExtension): bool return false; } - return self::EXT_ICON_NAME !== $filenameWithoutExtension; + return $filenameWithoutExtension !== self::EXT_ICON_NAME; } } diff --git a/src/FileProcessor/TypoScript/Conditions/AdminUserConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/AdminUserConditionMatcher.php index fe8ae8489..601029d6a 100644 --- a/src/FileProcessor/TypoScript/Conditions/AdminUserConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/AdminUserConditionMatcher.php @@ -23,7 +23,7 @@ public function change(string $condition): ?string $value = (int) $matches['value']; - if (1 === $value) { + if ($value === 1) { return 'backend.user.isAdmin'; } diff --git a/src/FileProcessor/TypoScript/Conditions/ApplicationContextConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/ApplicationContextConditionMatcher.php index 8be1c8d99..b7e184823 100644 --- a/src/FileProcessor/TypoScript/Conditions/ApplicationContextConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/ApplicationContextConditionMatcher.php @@ -48,11 +48,11 @@ public function shouldApply(string $condition): bool return false; } - return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition); + return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1; } private function isRegularExpression(string $regularExpression): bool { - return false !== @preg_match($regularExpression, ''); + return @preg_match($regularExpression, '') !== false; } } diff --git a/src/FileProcessor/TypoScript/Conditions/GlobalStringConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/GlobalStringConditionMatcher.php index 77c6bff91..69d1c6c88 100644 --- a/src/FileProcessor/TypoScript/Conditions/GlobalStringConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/GlobalStringConditionMatcher.php @@ -84,7 +84,7 @@ private function refactorGetPost(string $property, string $operator, string $val $value = sprintf("'%s'", $value); } - if (1 === count($parameters)) { + if (count($parameters) === 1) { return sprintf( 'request.getQueryParams()[\'%1$s\'] %2$s %3$s', $parameters[0], diff --git a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php index 1ce787dba..03f0831c2 100644 --- a/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/GlobalVarConditionMatcher.php @@ -92,7 +92,7 @@ public function change(string $condition): ?string foreach ($keys as $key) { [, , $operator] = explode('.', $key); - if ('=' === $operator && is_countable($conditions[$key]) && count($conditions[$key]) > 1) { + if ($operator === '=' && is_countable($conditions[$key]) && count($conditions[$key]) > 1) { $values = []; $condition = ''; foreach ($conditions[$key] as $value) { @@ -122,7 +122,7 @@ public function shouldApply(string $condition): bool private function refactorGetPost(string $property, string $operator, string $value): string { - if ('L' === $property) { + if ($property === 'L') { return sprintf('siteLanguage("languageId") %s "%s"', self::OPERATOR_MAPPING[$operator], $value); } @@ -130,7 +130,7 @@ private function refactorGetPost(string $property, string $operator, string $val $parameters = $this->explodeParameters($property); - if (1 === count($parameters)) { + if (count($parameters) === 1) { return sprintf( 'request.getQueryParams()[\'%1$s\'] %2$s %3$s', $parameters[0], @@ -139,7 +139,7 @@ private function refactorGetPost(string $property, string $operator, string $val ); } - if ('_POST' === $property) { + if ($property === '_POST') { return sprintf( 'traverse(request.getParsedBody(), \'%1$s\') %2$s %3$s) %2$s %3$s', implode('/', $parameters), diff --git a/src/FileProcessor/TypoScript/Conditions/HostnameConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/HostnameConditionMatcher.php index ae4ef8afd..c39d90a3b 100644 --- a/src/FileProcessor/TypoScript/Conditions/HostnameConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/HostnameConditionMatcher.php @@ -48,6 +48,6 @@ public function shouldApply(string $condition): bool return false; } - return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition); + return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1; } } diff --git a/src/FileProcessor/TypoScript/Conditions/LoginUserConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/LoginUserConditionMatcher.php index ca92889e4..6d3800b83 100644 --- a/src/FileProcessor/TypoScript/Conditions/LoginUserConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/LoginUserConditionMatcher.php @@ -22,7 +22,7 @@ public function change(string $condition): ?string return $condition; } - if (! isset($matches[1]) || '' === $matches[1]) { + if (! isset($matches[1]) || $matches[1] === '') { return 'loginUser("*") == false'; } @@ -33,6 +33,6 @@ public function change(string $condition): ?string public function shouldApply(string $condition): bool { - return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=#', $condition); + return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=#', $condition) === 1; } } diff --git a/src/FileProcessor/TypoScript/Conditions/PageConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/PageConditionMatcher.php index 46b5e8a5c..89814d546 100644 --- a/src/FileProcessor/TypoScript/Conditions/PageConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/PageConditionMatcher.php @@ -34,6 +34,6 @@ public function change(string $condition): ?string public function shouldApply(string $condition): bool { - return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '\|#', $condition); + return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '\|#', $condition) === 1; } } diff --git a/src/FileProcessor/TypoScript/Conditions/TimeConditionMatcher.php b/src/FileProcessor/TypoScript/Conditions/TimeConditionMatcher.php index ea6f43704..428a0ba1d 100644 --- a/src/FileProcessor/TypoScript/Conditions/TimeConditionMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/TimeConditionMatcher.php @@ -62,7 +62,7 @@ public function change(string $condition): ?string $operator = $operatorAndValueMatches['operator'] ?? ''; $value = $operatorAndValueMatches['value'] ?? ''; - if ('' === $operator) { + if ($operator === '') { $operator = '='; } @@ -79,6 +79,6 @@ public function change(string $condition): ?string public function shouldApply(string $condition): bool { - return null !== Strings::match($condition, '#' . self::ALLOWED_TIME_CONSTANTS . '#Ui'); + return Strings::match($condition, '#' . self::ALLOWED_TIME_CONSTANTS . '#Ui') !== null; } } diff --git a/src/FileProcessor/TypoScript/Conditions/UsergroupConditionMatcherMatcher.php b/src/FileProcessor/TypoScript/Conditions/UsergroupConditionMatcherMatcher.php index b3bd6b4b9..bfaed1e43 100644 --- a/src/FileProcessor/TypoScript/Conditions/UsergroupConditionMatcherMatcher.php +++ b/src/FileProcessor/TypoScript/Conditions/UsergroupConditionMatcherMatcher.php @@ -22,7 +22,7 @@ public function change(string $condition): ?string return $condition; } - if (! isset($matches[1]) || '' === $matches[1]) { + if (! isset($matches[1]) || $matches[1] === '') { return "usergroup('*') == false"; } @@ -33,6 +33,6 @@ public function change(string $condition): ?string public function shouldApply(string $condition): bool { - return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition); + return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1; } } diff --git a/src/FileProcessor/TypoScript/Rector/v10/v0/ExtbasePersistenceTypoScriptRector.php b/src/FileProcessor/TypoScript/Rector/v10/v0/ExtbasePersistenceTypoScriptRector.php index 5feeafc77..55256e270 100644 --- a/src/FileProcessor/TypoScript/Rector/v10/v0/ExtbasePersistenceTypoScriptRector.php +++ b/src/FileProcessor/TypoScript/Rector/v10/v0/ExtbasePersistenceTypoScriptRector.php @@ -133,7 +133,7 @@ public function getRuleDefinition(): RuleDefinition public function convert(): ?AddedFileWithContent { - if ([] === self::$persistenceArray) { + if (self::$persistenceArray === []) { return null; } @@ -188,7 +188,7 @@ public function configure(array $configuration): void { $filename = $configuration[self::FILENAME] ?? null; - if (null !== $filename) { + if ($filename !== null) { $this->filename = $filename; } } @@ -242,11 +242,11 @@ private function extractColumns(array $paths, Assignment $statement): void return; } - if (isset($paths[4]) && 'config' === $paths[4]) { + if (isset($paths[4]) && $paths[4] === 'config') { return; } - if (isset($paths[5]) && 'type' === $paths[5]) { + if (isset($paths[5]) && $paths[5] === 'type') { return; } diff --git a/src/FileProcessor/TypoScript/Rector/v11/v0/TemplateToFluidTemplateTypoScriptRector.php b/src/FileProcessor/TypoScript/Rector/v11/v0/TemplateToFluidTemplateTypoScriptRector.php index 39adc9298..e4cc863cf 100644 --- a/src/FileProcessor/TypoScript/Rector/v11/v0/TemplateToFluidTemplateTypoScriptRector.php +++ b/src/FileProcessor/TypoScript/Rector/v11/v0/TemplateToFluidTemplateTypoScriptRector.php @@ -27,7 +27,7 @@ public function enterNode(Statement $statement): void return; } - if ('TEMPLATE' !== $statement->value->value) { + if ($statement->value->value !== 'TEMPLATE') { return; } diff --git a/src/FileProcessor/TypoScript/Rector/v12/v0/RemoveDisableCharsetHeaderConfigTypoScriptRector.php b/src/FileProcessor/TypoScript/Rector/v12/v0/RemoveDisableCharsetHeaderConfigTypoScriptRector.php index 0ed74f16c..02c236705 100644 --- a/src/FileProcessor/TypoScript/Rector/v12/v0/RemoveDisableCharsetHeaderConfigTypoScriptRector.php +++ b/src/FileProcessor/TypoScript/Rector/v12/v0/RemoveDisableCharsetHeaderConfigTypoScriptRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('config.disableCharsetHeader' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.disableCharsetHeader') { return; } diff --git a/src/FileProcessor/TypoScript/Rector/v8/v7/LibFluidContentToLibContentElementRector.php b/src/FileProcessor/TypoScript/Rector/v8/v7/LibFluidContentToLibContentElementRector.php index 195f5ef23..c47d802dd 100644 --- a/src/FileProcessor/TypoScript/Rector/v8/v7/LibFluidContentToLibContentElementRector.php +++ b/src/FileProcessor/TypoScript/Rector/v8/v7/LibFluidContentToLibContentElementRector.php @@ -23,14 +23,14 @@ public function enterNode(Statement $statement): void return; } - if ('lib.fluidContent' === $statement->object->relativeName) { + if ($statement->object->relativeName === 'lib.fluidContent') { $this->hasChanged = true; $statement->object->relativeName = 'lib.contentElement'; return; } - if ('fluidContent' === $statement->object->relativeName) { + if ($statement->object->relativeName === 'fluidContent') { $this->hasChanged = true; $statement->object->relativeName = 'contentElement'; } diff --git a/src/FileProcessor/TypoScript/Rector/v9/v0/FileIncludeToImportStatementTypoScriptRector.php b/src/FileProcessor/TypoScript/Rector/v9/v0/FileIncludeToImportStatementTypoScriptRector.php index ff2012605..64a2cd8d4 100644 --- a/src/FileProcessor/TypoScript/Rector/v9/v0/FileIncludeToImportStatementTypoScriptRector.php +++ b/src/FileProcessor/TypoScript/Rector/v9/v0/FileIncludeToImportStatementTypoScriptRector.php @@ -35,7 +35,7 @@ public function enterNode(Statement $statement): void return; } - if (null !== $statement->condition) { + if ($statement->condition !== null) { return; } diff --git a/src/FileProcessor/TypoScript/Rector/v9/v4/OldConditionToExpressionLanguageTypoScriptRector.php b/src/FileProcessor/TypoScript/Rector/v9/v4/OldConditionToExpressionLanguageTypoScriptRector.php index f7b1977c4..711014a90 100644 --- a/src/FileProcessor/TypoScript/Rector/v9/v4/OldConditionToExpressionLanguageTypoScriptRector.php +++ b/src/FileProcessor/TypoScript/Rector/v9/v4/OldConditionToExpressionLanguageTypoScriptRector.php @@ -72,7 +72,7 @@ public function enterNode(Statement $statement): void $changedCondition = $conditionMatcher->change($condition); $applied = true; - if (null !== $changedCondition) { + if ($changedCondition !== null) { $newConditions[] = $changedCondition; } } @@ -90,19 +90,19 @@ public function enterNode(Statement $statement): void $file->addRectorClassWithLine(new RectorWithLineChange($this, $statement->sourceLine)); } - if ([] === $newConditions) { + if ($newConditions === []) { $statement->condition = ''; return; } - if (1 === count($newConditions)) { + if (count($newConditions) === 1) { $statement->condition = sprintf('[%s]', $newConditions[0]); return; } - if ([] === $operators) { + if ($operators === []) { $statement->condition = sprintf('[%s]', implode(' || ', $newConditions)); return; @@ -119,7 +119,7 @@ public function enterNode(Statement $statement): void $newCondition = ''; foreach ($newConditions as $key => $value) { $operator = $operators[$key]; - if ('' === $operator) { + if ($operator === '') { $newCondition .= $value; continue; } diff --git a/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php b/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php index 4bde3f12d..3c9f4f9dc 100644 --- a/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php +++ b/src/FileProcessor/TypoScript/TypoScriptFileProcessor.php @@ -142,7 +142,7 @@ public function __construct( public function supports(File $file, Configuration $configuration): bool { - if ([] === $this->typoScriptRectors) { + if ($this->typoScriptRectors === []) { return false; } @@ -205,7 +205,7 @@ private function processFile(File $file): void static fn (AbstractTypoScriptRector $typoScriptRector) => $typoScriptRector->hasChanged() ); - if ([] === $typoscriptRectorsWithChange) { + if ($typoscriptRectorsWithChange === []) { return; } diff --git a/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php b/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php index 1e21511d7..7c5b85bb8 100644 --- a/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php +++ b/src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php @@ -104,7 +104,7 @@ public function process(File $file, Configuration $configuration): array public function supports(File $file, Configuration $configuration): bool { // Prevent unnecessary processing - if ([] === $this->transformer) { + if ($this->transformer === []) { return false; } diff --git a/src/FileProcessor/Yaml/Form/Rector/v10/v0/EmailFinisherRector.php b/src/FileProcessor/Yaml/Form/Rector/v10/v0/EmailFinisherRector.php index e9b9b9cb1..f49954cf5 100644 --- a/src/FileProcessor/Yaml/Form/Rector/v10/v0/EmailFinisherRector.php +++ b/src/FileProcessor/Yaml/Form/Rector/v10/v0/EmailFinisherRector.php @@ -146,11 +146,11 @@ private function refactorFinishers(array $finishers, &$yamlToModify): bool continue; } - if ('replyToAddress' === $optionKey) { + if ($optionKey === 'replyToAddress') { $yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['replyToRecipients'][] = $optionValue; - } elseif ('carbonCopyAddress' === $optionKey) { + } elseif ($optionKey === 'carbonCopyAddress') { $yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['carbonCopyRecipients'][] = $optionValue; - } elseif ('blindCarbonCopyAddress' === $optionKey) { + } elseif ($optionKey === 'blindCarbonCopyAddress') { $yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['blindCarbonCopyRecipients'][] = $optionValue; } diff --git a/src/Helper/ArrayUtility.php b/src/Helper/ArrayUtility.php index 2a5bcd39a..03492ae69 100644 --- a/src/Helper/ArrayUtility.php +++ b/src/Helper/ArrayUtility.php @@ -17,7 +17,7 @@ public static function trimExplode( bool $removeEmptyValues = false, int $limit = 0 ): array { - if ('' === $delimiter) { + if ($delimiter === '') { throw new InvalidArgumentException('Please define a correct delimiter'); } @@ -26,7 +26,7 @@ public static function trimExplode( if ($removeEmptyValues) { $temp = []; foreach ($result as $value) { - if ('' !== trim($value)) { + if (trim($value) !== '') { $temp[] = $value; } } diff --git a/src/Helper/Database/Refactorings/DatabaseConnectionExecInsertQueryRefactoring.php b/src/Helper/Database/Refactorings/DatabaseConnectionExecInsertQueryRefactoring.php index e4f25d075..de0a72c29 100644 --- a/src/Helper/Database/Refactorings/DatabaseConnectionExecInsertQueryRefactoring.php +++ b/src/Helper/Database/Refactorings/DatabaseConnectionExecInsertQueryRefactoring.php @@ -54,6 +54,6 @@ public function refactor(MethodCall $oldMethodCall): array public function canHandle(string $methodName): bool { - return 'exec_INSERTquery' === $methodName; + return $methodName === 'exec_INSERTquery'; } } diff --git a/src/Helper/Database/Refactorings/DatabaseConnectionExecTruncateTableRefactoring.php b/src/Helper/Database/Refactorings/DatabaseConnectionExecTruncateTableRefactoring.php index bc9f18f66..fbd390bb0 100644 --- a/src/Helper/Database/Refactorings/DatabaseConnectionExecTruncateTableRefactoring.php +++ b/src/Helper/Database/Refactorings/DatabaseConnectionExecTruncateTableRefactoring.php @@ -49,6 +49,6 @@ public function refactor(MethodCall $oldMethodCall): array public function canHandle(string $methodName): bool { - return 'exec_TRUNCATEquery' === $methodName; + return $methodName === 'exec_TRUNCATEquery'; } } diff --git a/src/Helper/FluentChainMethodCallNodeAnalyzer.php b/src/Helper/FluentChainMethodCallNodeAnalyzer.php index 0ac1b9b13..1802ba653 100644 --- a/src/Helper/FluentChainMethodCallNodeAnalyzer.php +++ b/src/Helper/FluentChainMethodCallNodeAnalyzer.php @@ -30,7 +30,7 @@ public function collectMethodCallNamesInChain(MethodCall $desiredMethodCall): ar $methodNames = []; foreach ($methodCalls as $methodCall) { $methodName = $this->nodeNameResolver->getName($methodCall->name); - if (null === $methodName) { + if ($methodName === null) { continue; } @@ -55,7 +55,7 @@ public function collectAllMethodCallsInChain(MethodCall $methodCall): array } // traverse down - if (1 === count($chainMethodCalls)) { + if (count($chainMethodCalls) === 1) { $currentNode = $methodCall->getAttribute(AttributeKey::PARENT_NODE); while ($currentNode instanceof MethodCall) { $chainMethodCalls[] = $currentNode; diff --git a/src/Helper/OldSeverityToLogLevelMapper.php b/src/Helper/OldSeverityToLogLevelMapper.php index d1135b70b..14bd4ea20 100644 --- a/src/Helper/OldSeverityToLogLevelMapper.php +++ b/src/Helper/OldSeverityToLogLevelMapper.php @@ -21,23 +21,23 @@ public function __construct(NodeFactory $nodeFactory) public function mapSeverityToLogLevel(int $severityValue): ClassConstFetch { - if (0 === $severityValue) { + if ($severityValue === 0) { return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Log\LogLevel', 'INFO'); } - if (1 === $severityValue) { + if ($severityValue === 1) { return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Log\LogLevel', 'NOTICE'); } - if (2 === $severityValue) { + if ($severityValue === 2) { return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Log\LogLevel', 'WARNING'); } - if (3 === $severityValue) { + if ($severityValue === 3) { return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Log\LogLevel', 'ERROR'); } - if (4 === $severityValue) { + if ($severityValue === 4) { return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Log\LogLevel', 'CRITICAL'); } diff --git a/src/Helper/TcaHelperTrait.php b/src/Helper/TcaHelperTrait.php index f3fa0f3f4..9206cece4 100644 --- a/src/Helper/TcaHelperTrait.php +++ b/src/Helper/TcaHelperTrait.php @@ -18,7 +18,7 @@ protected function isFullTca(Return_ $return): bool $ctrlArrayItem = $this->extractCtrl($return); $columnsArrayItem = $this->extractColumns($return); - return null !== $ctrlArrayItem && null !== $columnsArrayItem; + return $ctrlArrayItem !== null && $columnsArrayItem !== null; } protected function extractArrayItemByKey(?Node $node, string $key): ?ArrayItem @@ -129,7 +129,7 @@ private function isConfigType(Array_ $columnItemConfigurationArray, string $type private function hasRenderType(Array_ $columnItemConfigurationArray): bool { $renderTypeItem = $this->extractArrayItemByKey($columnItemConfigurationArray, 'renderType'); - return null !== $renderTypeItem; + return $renderTypeItem !== null; } private function extractColumns(Return_ $return): ?ArrayItem @@ -202,7 +202,7 @@ private function extractColumnConfig(Array_ $array, string $keyName = 'config'): $columnName = $this->getValue($columnConfig->key); - if (null === $columnName) { + if ($columnName === null) { continue; } diff --git a/src/NodeAnalyzer/CommandMethodDecorator.php b/src/NodeAnalyzer/CommandMethodDecorator.php index c0db51efe..c04f16568 100644 --- a/src/NodeAnalyzer/CommandMethodDecorator.php +++ b/src/NodeAnalyzer/CommandMethodDecorator.php @@ -45,7 +45,7 @@ public function __construct(NodeFactory $nodeFactory, NodeNameResolver $nodeName */ public function decorate(ClassMethod $classMethod, array $commandInputArguments): void { - if ([] === $commandInputArguments) { + if ($commandInputArguments === []) { return; } @@ -83,7 +83,7 @@ private function addArgumentsToConfigureMethod(ClassMethod $classMethod, array $ */ private function addArgumentsToExecuteMethod(ClassMethod $classMethod, array $commandInputArguments): void { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { return; } diff --git a/src/NodeFactory/InitializeArgumentsClassMethodFactory.php b/src/NodeFactory/InitializeArgumentsClassMethodFactory.php index 474ffe96a..d64a519bd 100644 --- a/src/NodeFactory/InitializeArgumentsClassMethodFactory.php +++ b/src/NodeFactory/InitializeArgumentsClassMethodFactory.php @@ -189,7 +189,7 @@ private function createStmts(ClassMethod $renderMethod, Class_ $class): array if ($param->default instanceof Expr) { $args[] = new ConstFetch(new Name('false')); $defaultValue = $this->valueResolver->getValue($param->default); - if (null !== $defaultValue && 'null' !== $defaultValue) { + if ($defaultValue !== null && $defaultValue !== 'null') { $args[] = $defaultValue; } } else { @@ -237,7 +237,7 @@ private function getDescription(?ParamTagValueNode $paramTagValueNode): string private function createTypeInString(?ParamTagValueNode $paramTagValueNode, Param $param): string { - if (null !== $param->type) { + if ($param->type !== null) { return $this->resolveParamType($param->type); } @@ -347,7 +347,7 @@ private function getParentClassesMethodReflection(Class_ $class, string $methodN private function doesParentClassMethodExist(Class_ $class, string $methodName): bool { - return [] !== $this->getParentClassesMethodReflection($class, $methodName); + return $this->getParentClassesMethodReflection($class, $methodName) !== []; } /** @@ -364,7 +364,7 @@ private function extractArgumentsFromParentClasses(Class_ $class): array continue; } - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { continue; } @@ -383,7 +383,7 @@ private function extractArgumentsFromParentClasses(Class_ $class): array $value = $this->valueResolver->getValue($stmt->expr->args[0]->value); - if (null === $value) { + if ($value === null) { continue; } @@ -401,7 +401,7 @@ private function transformDocStringToClassConstantIfPossible(string $docString) { // remove leading slash $classLikeName = ltrim($docString, '\\'); - if ('' === $classLikeName) { + if ($classLikeName === '') { return $docString; } diff --git a/src/Rector/Experimental/ObjectManagerGetToConstructorInjectionRector.php b/src/Rector/Experimental/ObjectManagerGetToConstructorInjectionRector.php index 712c2bcf4..976ec3c99 100644 --- a/src/Rector/Experimental/ObjectManagerGetToConstructorInjectionRector.php +++ b/src/Rector/Experimental/ObjectManagerGetToConstructorInjectionRector.php @@ -105,7 +105,7 @@ public function refactor(Node $node): ?Node public function replaceMethodCallWithPropertyFetchAndDependency(MethodCall $methodCall): ?PropertyFetch { $class = $this->valueResolver->getValue($methodCall->args[0]->value); - if (null === $class) { + if ($class === null) { return null; } diff --git a/src/Rector/Experimental/OptionalConstructorToHardRequirementRector.php b/src/Rector/Experimental/OptionalConstructorToHardRequirementRector.php index bf50fcad9..e5d38f3c9 100644 --- a/src/Rector/Experimental/OptionalConstructorToHardRequirementRector.php +++ b/src/Rector/Experimental/OptionalConstructorToHardRequirementRector.php @@ -52,7 +52,7 @@ public function refactor(Node $node): ?Node continue; } - if (null === $param->type) { + if ($param->type === null) { continue; } @@ -65,7 +65,7 @@ public function refactor(Node $node): ?Node } $paramName = $this->nodeNameResolver->getName($param->var); - if (null === $paramName) { + if ($paramName === null) { continue; } @@ -88,7 +88,7 @@ public function refactor(Node $node): ?Node } $variableName = $this->nodeNameResolver->getName($stmt->expr->var); - if ($stmt->expr->var instanceof Variable && null !== $variableName) { + if ($stmt->expr->var instanceof Variable && $variableName !== null) { $potentialStmtsToRemove[$variableName] = $stmt; } @@ -107,7 +107,7 @@ public function refactor(Node $node): ?Node if ($stmt->expr->expr->right instanceof Coalesce) { // Reset param default value $paramDefault = $this->nodeNameResolver->getName($stmt->expr->expr->left); - if (null === $paramDefault) { + if ($paramDefault === null) { continue; } @@ -139,7 +139,7 @@ public function refactor(Node $node): ?Node $variableName = $this->nodeNameResolver->getName($stmt->expr->expr->var); - if (null === $variableName) { + if ($variableName === null) { continue; } diff --git a/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php b/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php index 329be3aee..cd72bfe47 100644 --- a/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php +++ b/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php @@ -69,7 +69,7 @@ public function refactor(Node $node): ?Node $variableName = $this->getName($node); - if (null === $variableName) { + if ($variableName === null) { return null; } diff --git a/src/Rector/General/ExtEmConfRector.php b/src/Rector/General/ExtEmConfRector.php index 6a5b5f515..57762f65c 100644 --- a/src/Rector/General/ExtEmConfRector.php +++ b/src/Rector/General/ExtEmConfRector.php @@ -89,7 +89,7 @@ public function refactor(Node $node): ?Node return null; } - if ([] === $node->expr->items || null === $node->expr->items) { + if ($node->expr->items === [] || $node->expr->items === null) { return null; } @@ -108,7 +108,7 @@ public function refactor(Node $node): ?Node continue; } - if ('' === $this->targetTypo3VersionConstraint) { + if ($this->targetTypo3VersionConstraint === '') { continue; } @@ -120,7 +120,7 @@ public function refactor(Node $node): ?Node continue; } - if (null === $item->value->items) { + if ($item->value->items === null) { continue; } @@ -138,7 +138,7 @@ public function refactor(Node $node): ?Node continue; } - if (null === $constraintItem->value->items) { + if ($constraintItem->value->items === null) { continue; } diff --git a/src/Rector/General/InjectMethodToConstructorInjectionRector.php b/src/Rector/General/InjectMethodToConstructorInjectionRector.php index 333f937a2..be0e3b589 100644 --- a/src/Rector/General/InjectMethodToConstructorInjectionRector.php +++ b/src/Rector/General/InjectMethodToConstructorInjectionRector.php @@ -103,13 +103,13 @@ public function refactor(Node $node): ?Node static fn ($classMethod) => str_starts_with((string) $classMethod->name, 'inject') ); - if ([] === $injectMethods) { + if ($injectMethods === []) { return null; } foreach ($injectMethods as $injectMethod) { $params = $injectMethod->getParams(); - if ([] === $params) { + if ($params === []) { continue; } @@ -124,7 +124,7 @@ public function refactor(Node $node): ?Node $paramName = $this->getName($param->var); - if (null === $paramName) { + if ($paramName === null) { continue; } @@ -140,7 +140,7 @@ public function refactor(Node $node): ?Node private function shouldSkip(Class_ $class): bool { - return [] === $class->getMethods(); + return $class->getMethods() === []; } /** diff --git a/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php b/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php index 5427bc7e9..379a76d4d 100644 --- a/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php +++ b/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php @@ -54,7 +54,7 @@ public function refactor(Node $node): ?Node $className = $this->nodeNameResolver->getName($node->class); - if (null === $className) { + if ($className === null) { return null; } @@ -103,7 +103,7 @@ public function configure(array $configuration): void private function shouldSkip(StaticCall $staticCall): bool { - if ([] === $this->classes) { + if ($this->classes === []) { return true; } diff --git a/src/Rector/Migrations/RenameClassMapAliasRector.php b/src/Rector/Migrations/RenameClassMapAliasRector.php index 71e5ccc29..a679c4447 100644 --- a/src/Rector/Migrations/RenameClassMapAliasRector.php +++ b/src/Rector/Migrations/RenameClassMapAliasRector.php @@ -150,7 +150,7 @@ public function configure(array $configuration): void } } - if ([] !== $this->oldToNewClasses) { + if ($this->oldToNewClasses !== []) { $this->renamedClassesDataCollector->addOldToNewClasses($this->oldToNewClasses); } @@ -170,7 +170,7 @@ private function stringClassNameToClassConstantRectorIfPossible(String_ $node): // remove leading slash $classLikeName = ltrim($classLikeName, '\\'); - if ('' === $classLikeName) { + if ($classLikeName === '') { return null; } diff --git a/src/Rector/v10/v0/ChangeDefaultCachingFrameworkNamesRector.php b/src/Rector/v10/v0/ChangeDefaultCachingFrameworkNamesRector.php index eb7ece811..3481caacb 100644 --- a/src/Rector/v10/v0/ChangeDefaultCachingFrameworkNamesRector.php +++ b/src/Rector/v10/v0/ChangeDefaultCachingFrameworkNamesRector.php @@ -44,7 +44,7 @@ public function refactor(Node $node): ?Node $argValue = $node->args[0]->value; $argument = $this->valueResolver->getValue($argValue); - if (null === $argument) { + if ($argument === null) { return null; } diff --git a/src/Rector/v10/v0/RefactorIdnaEncodeMethodToNativeFunctionRector.php b/src/Rector/v10/v0/RefactorIdnaEncodeMethodToNativeFunctionRector.php index 96c0a84c3..013ef5d54 100644 --- a/src/Rector/v10/v0/RefactorIdnaEncodeMethodToNativeFunctionRector.php +++ b/src/Rector/v10/v0/RefactorIdnaEncodeMethodToNativeFunctionRector.php @@ -47,7 +47,7 @@ public function refactor(Node $node): ?Node } $arguments = $node->args; - if ([] === $arguments) { + if ($arguments === []) { return null; } diff --git a/src/Rector/v10/v0/SwiftMailerBasedMailMessageToMailerBasedMessageRector.php b/src/Rector/v10/v0/SwiftMailerBasedMailMessageToMailerBasedMessageRector.php index 96faa7a0f..77f7058d4 100644 --- a/src/Rector/v10/v0/SwiftMailerBasedMailMessageToMailerBasedMessageRector.php +++ b/src/Rector/v10/v0/SwiftMailerBasedMailMessageToMailerBasedMessageRector.php @@ -120,11 +120,11 @@ private function refactorMethodSetBody(MethodCall $methodCall): ?MethodCall } $methodIdentifier = 'text'; - if ('text/html' === $contentType) { + if ($contentType === 'text/html') { $methodIdentifier = 'html'; } - if (null !== $contentType) { + if ($contentType !== null) { unset($methodCall->args[1]); } @@ -145,7 +145,7 @@ private function refactorMethodAddPart(MethodCall $methodCall): ?Node unset($methodCall->args[1]); - if ('text/html' === $contentType) { + if ($contentType === 'text/html') { $methodCall->name = new Identifier('html'); return $methodCall; } diff --git a/src/Rector/v10/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php b/src/Rector/v10/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php index 008cdf507..3ba250a40 100644 --- a/src/Rector/v10/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php +++ b/src/Rector/v10/v0/UseControllerClassesInExtbasePluginsAndModulesRector.php @@ -68,14 +68,14 @@ public function refactor(Node $node): ?Node } $delimiterPosition = strrpos($extensionName, '.'); - if (false === $delimiterPosition) { + if ($delimiterPosition === false) { return null; } $vendorName = $this->prepareVendorName($extensionName, $delimiterPosition); $extensionName = StringUtility::prepareExtensionName($extensionName, $delimiterPosition); - if ('' === $extensionName) { + if ($extensionName === '') { return null; } @@ -154,7 +154,7 @@ private function createNewControllerActionsArray( $controllerClassName = $this->valueResolver->getValue($controllerActions->key); - if (null === $controllerClassName) { + if ($controllerClassName === null) { continue; } @@ -201,7 +201,7 @@ private function isPotentiallyUndefinedExtensionKeyVariable(Concat $extensionNam return false; } - return null === $this->valueResolver->getValue($extensionNameArgumentValue->right); + return $this->valueResolver->getValue($extensionNameArgumentValue->right) === null; } private function prepareVendorName(string $extensionName, int $delimiterPosition): string diff --git a/src/Rector/v10/v0/typoscript/RemoveUseCacheHashRector.php b/src/Rector/v10/v0/typoscript/RemoveUseCacheHashRector.php index 9274cc66c..9043a695c 100644 --- a/src/Rector/v10/v0/typoscript/RemoveUseCacheHashRector.php +++ b/src/Rector/v10/v0/typoscript/RemoveUseCacheHashRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('useCacheHash' !== $statement->object->relativeName) { + if ($statement->object->relativeName !== 'useCacheHash') { return; } diff --git a/src/Rector/v10/v1/RegisterPluginWithVendorNameRector.php b/src/Rector/v10/v1/RegisterPluginWithVendorNameRector.php index 4edf95544..5e70f8ae0 100644 --- a/src/Rector/v10/v1/RegisterPluginWithVendorNameRector.php +++ b/src/Rector/v10/v1/RegisterPluginWithVendorNameRector.php @@ -93,7 +93,7 @@ private function removeVendorNameIfNeeded(StaticCall $staticCall): ?Node } $delimiterPosition = strrpos($extensionName, '.'); - if (false === $delimiterPosition) { + if ($delimiterPosition === false) { return null; } @@ -108,7 +108,7 @@ private function isPotentiallyUndefinedExtensionKeyVariable(Concat $extensionNam return false; } - if (null !== $this->valueResolver->getValue($extensionNameArgumentValue->right)) { + if ($this->valueResolver->getValue($extensionNameArgumentValue->right) !== null) { return false; } diff --git a/src/Rector/v10/v1/RemoveEnableMultiSelectFilterTextfieldRector.php b/src/Rector/v10/v1/RemoveEnableMultiSelectFilterTextfieldRector.php index ccc61f9be..a7d112f42 100644 --- a/src/Rector/v10/v1/RemoveEnableMultiSelectFilterTextfieldRector.php +++ b/src/Rector/v10/v1/RemoveEnableMultiSelectFilterTextfieldRector.php @@ -67,7 +67,7 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void $nodeValue = $this->valueResolver->getValue($toRemoveArrayItem->value); - if (true === $nodeValue) { + if ($nodeValue === true) { $this->removeNode($toRemoveArrayItem); $this->hasAstBeenChanged = true; } diff --git a/src/Rector/v10/v3/RemoveExcludeOnTransOrigPointerFieldRector.php b/src/Rector/v10/v3/RemoveExcludeOnTransOrigPointerFieldRector.php index 1e4133e3c..5daef5ca1 100644 --- a/src/Rector/v10/v3/RemoveExcludeOnTransOrigPointerFieldRector.php +++ b/src/Rector/v10/v3/RemoveExcludeOnTransOrigPointerFieldRector.php @@ -76,7 +76,7 @@ public function refactor(Node $node): ?Node } } - if (null === $transOrigPointerField) { + if ($transOrigPointerField === null) { return null; } @@ -111,7 +111,7 @@ public function refactor(Node $node): ?Node $configFieldName = $this->valueResolver->getValue($configValue->key); - if ('exclude' === $configFieldName) { + if ($configFieldName === 'exclude') { $this->removeNode($configValue); $hasAstBeenChanged = true; } diff --git a/src/Rector/v10/v3/RemoveShowRecordFieldListInsideInterfaceSectionRector.php b/src/Rector/v10/v3/RemoveShowRecordFieldListInsideInterfaceSectionRector.php index 27007ad7a..1ad5dcc82 100644 --- a/src/Rector/v10/v3/RemoveShowRecordFieldListInsideInterfaceSectionRector.php +++ b/src/Rector/v10/v3/RemoveShowRecordFieldListInsideInterfaceSectionRector.php @@ -70,7 +70,7 @@ public function refactor(Node $node): ?Node } } - if (0 === $remainingInterfaceItems) { + if ($remainingInterfaceItems === 0) { $this->removeNode($interface); return $node; } diff --git a/src/Rector/v10/v3/UseClassTypo3InformationRector.php b/src/Rector/v10/v3/UseClassTypo3InformationRector.php index 8251da1fe..bb0be8b64 100644 --- a/src/Rector/v10/v3/UseClassTypo3InformationRector.php +++ b/src/Rector/v10/v3/UseClassTypo3InformationRector.php @@ -46,35 +46,35 @@ public function refactor(Node $node): ?Node $nodeName = $this->getName($node->name); - if ('TYPO3_URL_GENERAL' === $nodeName) { + if ($nodeName === 'TYPO3_URL_GENERAL') { return $this->nodeFactory->createClassConstFetch( 'TYPO3\CMS\Core\Information\Typo3Information', 'URL_COMMUNITY' ); } - if ('TYPO3_URL_LICENSE' === $nodeName) { + if ($nodeName === 'TYPO3_URL_LICENSE') { return $this->nodeFactory->createClassConstFetch( 'TYPO3\CMS\Core\Information\Typo3Information', 'URL_LICENSE' ); } - if ('TYPO3_URL_EXCEPTION' === $nodeName) { + if ($nodeName === 'TYPO3_URL_EXCEPTION') { return $this->nodeFactory->createClassConstFetch( 'TYPO3\CMS\Core\Information\Typo3Information', 'URL_EXCEPTION' ); } - if ('TYPO3_URL_DONATE' === $nodeName) { + if ($nodeName === 'TYPO3_URL_DONATE') { return $this->nodeFactory->createClassConstFetch( 'TYPO3\CMS\Core\Information\Typo3Information', 'URL_DONATE' ); } - if ('TYPO3_URL_WIKI_OPCODECACHE' === $nodeName) { + if ($nodeName === 'TYPO3_URL_WIKI_OPCODECACHE') { return $this->nodeFactory->createClassConstFetch( 'TYPO3\CMS\Core\Information\Typo3Information', 'URL_OPCACHE' diff --git a/src/Rector/v10/v4/SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector.php b/src/Rector/v10/v4/SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector.php index a64f8ee7d..a1e895791 100644 --- a/src/Rector/v10/v4/SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector.php +++ b/src/Rector/v10/v4/SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector.php @@ -50,22 +50,22 @@ public function refactor(Node $node): ?Node $nodeName = $this->getName($node->name); - if ('IPv6Hex2Bin' === $nodeName) { + if ($nodeName === 'IPv6Hex2Bin') { return $this->nodeFactory->createFuncCall('inet_pton', $node->args); } - if ('IPv6Bin2Hex' === $nodeName) { + if ($nodeName === 'IPv6Bin2Hex') { return $this->nodeFactory->createFuncCall('inet_ntop', $node->args); } - if ('compressIPv6' === $nodeName) { + if ($nodeName === 'compressIPv6') { return $this->nodeFactory->createFuncCall( 'inet_ntop', [$this->nodeFactory->createFuncCall('inet_pton', $node->args)] ); } - if ('milliseconds' === $nodeName) { + if ($nodeName === 'milliseconds') { return $this->nodeFactory->createFuncCall('round', [ new Mul($this->nodeFactory->createFuncCall( 'microtime', diff --git a/src/Rector/v10/v4/UseFileGetContentsForGetUrlRector.php b/src/Rector/v10/v4/UseFileGetContentsForGetUrlRector.php index 5f8af82a0..25822a5ad 100644 --- a/src/Rector/v10/v4/UseFileGetContentsForGetUrlRector.php +++ b/src/Rector/v10/v4/UseFileGetContentsForGetUrlRector.php @@ -49,7 +49,7 @@ public function refactor(Node $node): ?Node $urlValue = $this->valueResolver->getValue($node->args[0]->value); - if (null === $urlValue) { + if ($urlValue === null) { return null; } diff --git a/src/Rector/v10/v4/UseIconsFromSubFolderInIconRegistryRector.php b/src/Rector/v10/v4/UseIconsFromSubFolderInIconRegistryRector.php index a97b6efd1..518ed31a8 100644 --- a/src/Rector/v10/v4/UseIconsFromSubFolderInIconRegistryRector.php +++ b/src/Rector/v10/v4/UseIconsFromSubFolderInIconRegistryRector.php @@ -113,7 +113,7 @@ private function isSvgIconProvider(MethodCall $methodCall): bool { $iconProviderClassName = $this->valueResolver->getValue($methodCall->args[1]->value); - if (null === $iconProviderClassName) { + if ($iconProviderClassName === null) { return false; } diff --git a/src/Rector/v11/v0/ExtbaseControllerActionsMustReturnResponseInterfaceRector.php b/src/Rector/v11/v0/ExtbaseControllerActionsMustReturnResponseInterfaceRector.php index 5169c5fb6..a4702d871 100644 --- a/src/Rector/v11/v0/ExtbaseControllerActionsMustReturnResponseInterfaceRector.php +++ b/src/Rector/v11/v0/ExtbaseControllerActionsMustReturnResponseInterfaceRector.php @@ -194,7 +194,7 @@ private function shouldSkip(ClassMethod $classMethod): bool $methodName = $this->getName($classMethod->name); - if (null === $methodName) { + if ($methodName === null) { return true; } @@ -235,7 +235,7 @@ private function findReturns(ClassMethod $classMethod): array private function lastStatementIsExitCall(ClassMethod $classMethod): bool { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { return false; } @@ -273,7 +273,7 @@ private function isAlreadyResponseReturnType(ClassMethod $classMethod): bool private function hasExceptionCall(ClassMethod $classMethod): bool { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { return false; } @@ -293,7 +293,7 @@ private function hasExceptionCall(ClassMethod $classMethod): bool private function lastStatementIsForwardCall(ClassMethod $classMethod): bool { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { return false; } diff --git a/src/Rector/v11/v0/ForwardResponseInsteadOfForwardMethodRector.php b/src/Rector/v11/v0/ForwardResponseInsteadOfForwardMethodRector.php index f4b21ffb7..a20a4db20 100644 --- a/src/Rector/v11/v0/ForwardResponseInsteadOfForwardMethodRector.php +++ b/src/Rector/v11/v0/ForwardResponseInsteadOfForwardMethodRector.php @@ -86,14 +86,14 @@ public function getNodeTypes(): array public function refactor(Node $node): ?Node { $forwardMethodCalls = $this->extractForwardMethodCalls($node); - if ([] === $forwardMethodCalls) { + if ($forwardMethodCalls === []) { return null; } foreach ($forwardMethodCalls as $forwardMethodCall) { $action = $this->valueResolver->getValue($forwardMethodCall->args[0]->value); - if (null === $action) { + if ($action === null) { return null; } @@ -134,7 +134,7 @@ public function refactor(Node $node): ?Node $this->removeNode($forwardMethodCall); } - if (null !== $node->returnType && $node->returnType instanceof Identifier && null !== $node->returnType->name && 'void' === $node->returnType->name) { + if ($node->returnType !== null && $node->returnType instanceof Identifier && $node->returnType->name !== null && $node->returnType->name === 'void') { $node->returnType = null; } @@ -146,7 +146,7 @@ public function refactor(Node $node): ?Node $node->setAttribute('comments', $comments); // Add returnType only if it is the only statement, otherwise it is not reliable - if (is_countable($node->stmts) && 1 === count((array) $node->stmts)) { + if (is_countable($node->stmts) && count((array) $node->stmts) === 1) { $node->returnType = new FullyQualified('Psr\Http\Message\ResponseInterface'); } diff --git a/src/Rector/v11/v0/GetClickMenuOnIconTagParametersRector.php b/src/Rector/v11/v0/GetClickMenuOnIconTagParametersRector.php index f40c00014..ed1b548a2 100644 --- a/src/Rector/v11/v0/GetClickMenuOnIconTagParametersRector.php +++ b/src/Rector/v11/v0/GetClickMenuOnIconTagParametersRector.php @@ -41,17 +41,17 @@ public function refactor(Node $node): ?Node return null; } - if (([] === $node->args) > 3) { + if (($node->args === []) > 3) { return null; } $returnTagParameters = isset($node->args[6]) ? $this->valueResolver->getValue($node->args[6]->value) : false; - if (null === $returnTagParameters) { + if ($returnTagParameters === null) { return null; } - if (false === $returnTagParameters) { + if ($returnTagParameters === false) { unset($node->args[3], $node->args[4], $node->args[5], $node->args[6]); return $node; } diff --git a/src/Rector/v11/v0/SubstituteConstantsModeAndRequestTypeRector.php b/src/Rector/v11/v0/SubstituteConstantsModeAndRequestTypeRector.php index c05729dcb..c90b643f4 100644 --- a/src/Rector/v11/v0/SubstituteConstantsModeAndRequestTypeRector.php +++ b/src/Rector/v11/v0/SubstituteConstantsModeAndRequestTypeRector.php @@ -83,13 +83,13 @@ public function refactor(Node $node): ?Node $parentNode->right ) : $this->valueResolver->getValue($parentNode->left); - if (null === $type || ! in_array($type, ['FE', 'BE'], true)) { + if ($type === null || ! in_array($type, ['FE', 'BE'], true)) { return null; } $this->removeNode($parentNode->left === $node ? $parentNode->right : $parentNode->left); - if ('BE' === $type) { + if ($type === 'BE') { return $this->createIsBackendCall($arguments); } diff --git a/src/Rector/v11/v3/MigrateLanguageFieldToTcaTypeLanguageRector.php b/src/Rector/v11/v3/MigrateLanguageFieldToTcaTypeLanguageRector.php index 4233bf9e5..248deb758 100644 --- a/src/Rector/v11/v3/MigrateLanguageFieldToTcaTypeLanguageRector.php +++ b/src/Rector/v11/v3/MigrateLanguageFieldToTcaTypeLanguageRector.php @@ -42,7 +42,7 @@ public function refactor(Node $node): ?Node } $this->languageField = $this->valueResolver->getValue($value); - if (null === $this->languageField) { + if ($this->languageField === null) { return null; } diff --git a/src/Rector/v11/v3/MigrateSpecialLanguagesToTcaTypeLanguageRector.php b/src/Rector/v11/v3/MigrateSpecialLanguagesToTcaTypeLanguageRector.php index 701bf1856..b6c32c63e 100644 --- a/src/Rector/v11/v3/MigrateSpecialLanguagesToTcaTypeLanguageRector.php +++ b/src/Rector/v11/v3/MigrateSpecialLanguagesToTcaTypeLanguageRector.php @@ -42,7 +42,7 @@ public function refactor(Node $node): ?Node } $this->languageField = $this->valueResolver->getValue($value); - if (null === $this->languageField) { + if ($this->languageField === null) { return null; } diff --git a/src/Rector/v11/v4/AddSetConfigurationMethodToExceptionHandlerRector.php b/src/Rector/v11/v4/AddSetConfigurationMethodToExceptionHandlerRector.php index 826e93aff..d1df7259a 100644 --- a/src/Rector/v11/v4/AddSetConfigurationMethodToExceptionHandlerRector.php +++ b/src/Rector/v11/v4/AddSetConfigurationMethodToExceptionHandlerRector.php @@ -76,7 +76,7 @@ public function refactor(Node $node): ?Node $constructClassMethod->stmts = []; - if ('' === $firstParameterName) { + if ($firstParameterName === '') { return $node; } @@ -143,7 +143,7 @@ private function shouldSkip(Class_ $class): bool } $className = $this->getName($class); - if (null === $className) { + if ($className === null) { return true; } @@ -187,7 +187,7 @@ private function renameFirstConstructorParameterVariableName( return $this->nodeNameResolver->isName($node, $firstParameterName); }); - if ([] === $variables) { + if ($variables === []) { return; } diff --git a/src/Rector/v11/v5/HandleCObjRendererATagParamsMethodRector.php b/src/Rector/v11/v5/HandleCObjRendererATagParamsMethodRector.php index 51af29605..c514f75d3 100644 --- a/src/Rector/v11/v5/HandleCObjRendererATagParamsMethodRector.php +++ b/src/Rector/v11/v5/HandleCObjRendererATagParamsMethodRector.php @@ -34,7 +34,7 @@ public function refactor(Node $node): ?Node return null; } - if (1 === count($node->args)) { + if (count($node->args) === 1) { return null; } diff --git a/src/Rector/v11/v5/SubstituteBackendTemplateViewWithModuleTemplateRector.php b/src/Rector/v11/v5/SubstituteBackendTemplateViewWithModuleTemplateRector.php index 34d8ad3e5..8c7fc71fa 100644 --- a/src/Rector/v11/v5/SubstituteBackendTemplateViewWithModuleTemplateRector.php +++ b/src/Rector/v11/v5/SubstituteBackendTemplateViewWithModuleTemplateRector.php @@ -214,7 +214,7 @@ private function createModuleTemplateAssignment(): Expression private function substituteModuleTemplateMethodCalls(ClassMethod $classMethod): void { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { return; } @@ -272,7 +272,7 @@ private function callSetContentAndGetContent(ClassMethod $classMethod): void $htmlResponseMethodCallReturn = new Return_($htmlResponseMethodCall); - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { $classMethod->stmts[] = $this->createModuleTemplateAssignment(); $classMethod->stmts[] = $callSetContentOnModuleTemplateVariable; $classMethod->stmts[] = $htmlResponseMethodCallReturn; @@ -293,11 +293,11 @@ function (Node $node) { return false; } - return [] === $node->args; + return $node->args === []; } ); - if ([] === $existingHtmlResponseMethodCallNodes) { + if ($existingHtmlResponseMethodCallNodes === []) { $classMethod->stmts[] = $callSetContentOnModuleTemplateVariable; $classMethod->stmts[] = $htmlResponseMethodCallReturn; return; @@ -316,7 +316,7 @@ function (Node $node) { private function callModuleTemplateFactoryCreateIfNeeded(ClassMethod $classMethod): void { - if (null === $classMethod->stmts) { + if ($classMethod->stmts === null) { $classMethod->stmts[] = $this->createModuleTemplateAssignment(); return; } @@ -340,7 +340,7 @@ function (Node $node) { } ); - if ([] === $existingModuleTemplateFactoryCreateMethodCall) { + if ($existingModuleTemplateFactoryCreateMethodCall === []) { $moduleTemplateFactoryAssignment = $this->createModuleTemplateAssignment(); array_unshift($classMethod->stmts, $moduleTemplateFactoryAssignment); } diff --git a/src/Rector/v12/v0/tca/MigrateNullFlagRector.php b/src/Rector/v12/v0/tca/MigrateNullFlagRector.php index 2cc2b00bf..25294eb8b 100644 --- a/src/Rector/v12/v0/tca/MigrateNullFlagRector.php +++ b/src/Rector/v12/v0/tca/MigrateNullFlagRector.php @@ -79,9 +79,9 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void $evalList = ArrayUtility::trimExplode(',', $value, true); // Remove "null" from $evalList - $evalList = array_filter($evalList, static fn (string $eval) => 'null' !== $eval); + $evalList = array_filter($evalList, static fn (string $eval) => $eval !== 'null'); - if ([] !== $evalList) { + if ($evalList !== []) { // Write back filtered 'eval' $evalArrayItem->value = new String_(implode(',', $evalList)); } else { diff --git a/src/Rector/v12/v0/tca/MigrateRequiredFlagRector.php b/src/Rector/v12/v0/tca/MigrateRequiredFlagRector.php index f4fd7e490..99e147fbd 100644 --- a/src/Rector/v12/v0/tca/MigrateRequiredFlagRector.php +++ b/src/Rector/v12/v0/tca/MigrateRequiredFlagRector.php @@ -85,9 +85,9 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void $evalList = ArrayUtility::trimExplode(',', $value, true); // Remove "required" from $evalList - $evalList = array_filter($evalList, static fn (string $eval) => self::REQUIRED !== $eval); + $evalList = array_filter($evalList, static fn (string $eval) => $eval !== self::REQUIRED); - if ([] !== $evalList) { + if ($evalList !== []) { // Write back filtered 'eval' $evalArrayItem->value = new String_(implode(',', $evalList)); } else { diff --git a/src/Rector/v12/v0/tca/RemoveCruserIdRector.php b/src/Rector/v12/v0/tca/RemoveCruserIdRector.php index 4c9edc905..ff3440dd0 100644 --- a/src/Rector/v12/v0/tca/RemoveCruserIdRector.php +++ b/src/Rector/v12/v0/tca/RemoveCruserIdRector.php @@ -70,7 +70,7 @@ public function refactor(Node $node): ?Node } } - if (0 === $remainingInterfaceItems) { + if ($remainingInterfaceItems === 0) { $this->removeNode($ctrl); return $node; } diff --git a/src/Rector/v12/v0/tca/RemoveTCAInterfaceAlwaysDescriptionRector.php b/src/Rector/v12/v0/tca/RemoveTCAInterfaceAlwaysDescriptionRector.php index 94837eea5..2221d8eca 100644 --- a/src/Rector/v12/v0/tca/RemoveTCAInterfaceAlwaysDescriptionRector.php +++ b/src/Rector/v12/v0/tca/RemoveTCAInterfaceAlwaysDescriptionRector.php @@ -70,7 +70,7 @@ public function refactor(Node $node): ?Node } } - if (0 === $remainingInterfaceItems) { + if ($remainingInterfaceItems === 0) { $this->removeNode($interface); return $node; } diff --git a/src/Rector/v12/v0/typo3/ChangeExtbaseValidatorsRector.php b/src/Rector/v12/v0/typo3/ChangeExtbaseValidatorsRector.php index d6b48dfee..bf406eb72 100644 --- a/src/Rector/v12/v0/typo3/ChangeExtbaseValidatorsRector.php +++ b/src/Rector/v12/v0/typo3/ChangeExtbaseValidatorsRector.php @@ -236,7 +236,7 @@ private function manipulateIsValidMethod(Class_ $node): void return; } - if (null !== $isValidClassMethod->returnType) { + if ($isValidClassMethod->returnType !== null) { return; } @@ -251,7 +251,7 @@ private function manipulateValidateMethod(Class_ $node): void return; } - if (null !== $validateClassMethod->returnType) { + if ($validateClassMethod->returnType !== null) { return; } diff --git a/src/Rector/v12/v0/typo3/ContentObjectRegistrationViaServiceConfigurationRector.php b/src/Rector/v12/v0/typo3/ContentObjectRegistrationViaServiceConfigurationRector.php index 85f4f55bf..0597f667b 100644 --- a/src/Rector/v12/v0/typo3/ContentObjectRegistrationViaServiceConfigurationRector.php +++ b/src/Rector/v12/v0/typo3/ContentObjectRegistrationViaServiceConfigurationRector.php @@ -83,13 +83,13 @@ public function refactor(Node $node): ?Node $contentObjectName = $this->valueResolver->getValue($node->var->dim); - if (null === $contentObjectName || '' === $contentObjectName) { + if ($contentObjectName === null || $contentObjectName === '') { return null; } $contentObjectNameClass = $this->valueResolver->getValue($node->expr); - if (null === $contentObjectNameClass || '' === $contentObjectNameClass) { + if ($contentObjectNameClass === null || $contentObjectNameClass === '') { return null; } diff --git a/src/Rector/v12/v0/typo3/HintNecessaryUploadedFileChangesRector.php b/src/Rector/v12/v0/typo3/HintNecessaryUploadedFileChangesRector.php index a3d4ab840..9d400f536 100644 --- a/src/Rector/v12/v0/typo3/HintNecessaryUploadedFileChangesRector.php +++ b/src/Rector/v12/v0/typo3/HintNecessaryUploadedFileChangesRector.php @@ -70,7 +70,7 @@ public function refactor(Node $node): ?Node return null; } - if ($params[0]->type instanceof Identifier && 'array' === $params[0]->type->name) { + if ($params[0]->type instanceof Identifier && $params[0]->type->name === 'array') { $comments = $affectedMethod->getComments(); $comments = array_filter( $comments, diff --git a/src/Rector/v12/v0/typo3/RegisterExtbaseTypeConvertersAsServicesRector.php b/src/Rector/v12/v0/typo3/RegisterExtbaseTypeConvertersAsServicesRector.php index 0b84789ee..8c2434941 100644 --- a/src/Rector/v12/v0/typo3/RegisterExtbaseTypeConvertersAsServicesRector.php +++ b/src/Rector/v12/v0/typo3/RegisterExtbaseTypeConvertersAsServicesRector.php @@ -171,7 +171,7 @@ private function collectServiceTags(array $classStatements): array return null; } - if (! $node instanceof ClassMethod || null === $node->stmts) { + if (! $node instanceof ClassMethod || $node->stmts === null) { return null; } diff --git a/src/Rector/v12/v0/typo3/UseCompositeExpressionStaticMethodsRector.php b/src/Rector/v12/v0/typo3/UseCompositeExpressionStaticMethodsRector.php index dd67b342f..ee2a64614 100644 --- a/src/Rector/v12/v0/typo3/UseCompositeExpressionStaticMethodsRector.php +++ b/src/Rector/v12/v0/typo3/UseCompositeExpressionStaticMethodsRector.php @@ -35,12 +35,12 @@ public function refactor(Node $node): ?Node return null; } - if ('Expr_ClassConstFetch' === $node->args[0]->value->getType()) { + if ($node->args[0]->value->getType() === 'Expr_ClassConstFetch') { /** @var Node\Expr\ClassConstFetch $firstArg */ $firstArg = $node->args[0]->value; /** @var Node\Identifier $identifier */ $identifier = $firstArg->name; - $methodType = 'TYPE_AND' === $identifier->name ? 'and' : 'or'; + $methodType = $identifier->name === 'TYPE_AND' ? 'and' : 'or'; } else { /** @var String_ $firstArg */ $firstArg = $node->args[0]->value; diff --git a/src/Rector/v12/v0/typo3/UseConfigArrayForTSFEPropertiesRector.php b/src/Rector/v12/v0/typo3/UseConfigArrayForTSFEPropertiesRector.php index 7ac62676d..939791bf5 100644 --- a/src/Rector/v12/v0/typo3/UseConfigArrayForTSFEPropertiesRector.php +++ b/src/Rector/v12/v0/typo3/UseConfigArrayForTSFEPropertiesRector.php @@ -61,7 +61,7 @@ public function refactor(Node $node): ?Node $propertyName = $this->nodeNameResolver->getName($node->name); - if (null === $propertyName) { + if ($propertyName === null) { return null; } diff --git a/src/Rector/v12/v0/typoscript/RemoveConfigDoctypeSwitchRector.php b/src/Rector/v12/v0/typoscript/RemoveConfigDoctypeSwitchRector.php index 7a52b843e..3964dd14b 100644 --- a/src/Rector/v12/v0/typoscript/RemoveConfigDoctypeSwitchRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveConfigDoctypeSwitchRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('config.doctypeSwitch' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.doctypeSwitch') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveDisablePageExternalUrlOptionRector.php b/src/Rector/v12/v0/typoscript/RemoveDisablePageExternalUrlOptionRector.php index e48304e9b..3374278d6 100644 --- a/src/Rector/v12/v0/typoscript/RemoveDisablePageExternalUrlOptionRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveDisablePageExternalUrlOptionRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('config.disablePageExternalUrl' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.disablePageExternalUrl') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveMetaCharSetRector.php b/src/Rector/v12/v0/typoscript/RemoveMetaCharSetRector.php index dffdf6201..3f3c39ba2 100644 --- a/src/Rector/v12/v0/typoscript/RemoveMetaCharSetRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveMetaCharSetRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('config.metaCharset' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.metaCharset') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveNewContentElementWizardOptionsRector.php b/src/Rector/v12/v0/typoscript/RemoveNewContentElementWizardOptionsRector.php index ed1a93bd0..c383082ae 100644 --- a/src/Rector/v12/v0/typoscript/RemoveNewContentElementWizardOptionsRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveNewContentElementWizardOptionsRector.php @@ -43,8 +43,8 @@ public function enterNode(Statement $statement): void return; } - if ('mod.web_layout.disableNewContentElementWizard' !== $statement->object->absoluteName - && 'mod.newContentElementWizard.override' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'mod.web_layout.disableNewContentElementWizard' + && $statement->object->absoluteName !== 'mod.newContentElementWizard.override') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveSendCacheHeadersConfigOptionRector.php b/src/Rector/v12/v0/typoscript/RemoveSendCacheHeadersConfigOptionRector.php index c74db34ac..fd3e36469 100644 --- a/src/Rector/v12/v0/typoscript/RemoveSendCacheHeadersConfigOptionRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveSendCacheHeadersConfigOptionRector.php @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void return; } - if ('config.sendCacheHeaders_onlyWhenLoginDeniedInBranch' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.sendCacheHeaders_onlyWhenLoginDeniedInBranch') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveSpamProtectEmailAddressesAsciiOptionRector.php b/src/Rector/v12/v0/typoscript/RemoveSpamProtectEmailAddressesAsciiOptionRector.php index bc8fae7cf..4b2191b95 100644 --- a/src/Rector/v12/v0/typoscript/RemoveSpamProtectEmailAddressesAsciiOptionRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveSpamProtectEmailAddressesAsciiOptionRector.php @@ -43,11 +43,11 @@ public function enterNode(Statement $statement): void return; } - if ('config.spamProtectEmailAddresses' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'config.spamProtectEmailAddresses') { return; } - if ('ascii' !== $statement->value->value) { + if ($statement->value->value !== 'ascii') { return; } diff --git a/src/Rector/v12/v0/typoscript/RemoveTSConfigModesRector.php b/src/Rector/v12/v0/typoscript/RemoveTSConfigModesRector.php index a69506a5e..df8a3702c 100644 --- a/src/Rector/v12/v0/typoscript/RemoveTSConfigModesRector.php +++ b/src/Rector/v12/v0/typoscript/RemoveTSConfigModesRector.php @@ -43,8 +43,8 @@ public function enterNode(Statement $statement): void return; } - if ('options.workspaces.swapMode' !== $statement->object->absoluteName - && 'options.workspaces.changeStageMode' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'options.workspaces.swapMode' + && $statement->object->absoluteName !== 'options.workspaces.changeStageMode') { return; } diff --git a/src/Rector/v12/v0/typoscript/RenameMailLinkHandlerKeyRector.php b/src/Rector/v12/v0/typoscript/RenameMailLinkHandlerKeyRector.php index e033e3f73..a09913fbc 100644 --- a/src/Rector/v12/v0/typoscript/RenameMailLinkHandlerKeyRector.php +++ b/src/Rector/v12/v0/typoscript/RenameMailLinkHandlerKeyRector.php @@ -28,7 +28,7 @@ public function enterNode(Statement $statement): void return; } - if ('TCEMAIN.linkHandler.mail' !== $statement->object->absoluteName) { + if ($statement->object->absoluteName !== 'TCEMAIN.linkHandler.mail') { return; } diff --git a/src/Rector/v7/v0/TypeHandlingServiceToTypeHandlingUtilityRector.php b/src/Rector/v7/v0/TypeHandlingServiceToTypeHandlingUtilityRector.php index 9b5deaba6..02c6d6171 100644 --- a/src/Rector/v7/v0/TypeHandlingServiceToTypeHandlingUtilityRector.php +++ b/src/Rector/v7/v0/TypeHandlingServiceToTypeHandlingUtilityRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node): ?Node $methodCall = $this->getName($node->name); - if (null === $methodCall) { + if ($methodCall === null) { return null; } diff --git a/src/Rector/v7/v4/DropAdditionalPaletteRector.php b/src/Rector/v7/v4/DropAdditionalPaletteRector.php index 1f981f04e..0d7aa0d36 100644 --- a/src/Rector/v7/v4/DropAdditionalPaletteRector.php +++ b/src/Rector/v7/v4/DropAdditionalPaletteRector.php @@ -82,7 +82,7 @@ protected function refactorType(Expr $typeKey, Expr $typeConfig): void $showItemValue = $this->valueResolver->getValue($showItemNode->value); if ( - null === $showItemValue + $showItemValue === null || ! is_string($showItemValue) || ! str_contains($showItemValue, ';') ) { @@ -98,7 +98,7 @@ protected function refactorType(Expr $typeKey, Expr $typeConfig): void self::FIELD_LABEL => $fieldArray[1] ?? null, self::PALETTE_NAME => $fieldArray[2] ?? null, ]; - if ('--palette--' !== $fieldArray[self::FIELD_NAME] && null !== $fieldArray[self::PALETTE_NAME]) { + if ($fieldArray[self::FIELD_NAME] !== '--palette--' && $fieldArray[self::PALETTE_NAME] !== null) { if ($fieldArray[self::FIELD_LABEL]) { $fieldString = $fieldArray[self::FIELD_NAME] . ';' . $fieldArray[self::FIELD_LABEL]; } else { diff --git a/src/Rector/v7/v4/MoveLanguageFilesFromRemovedCmsExtensionRector.php b/src/Rector/v7/v4/MoveLanguageFilesFromRemovedCmsExtensionRector.php index 9225069fd..ab46e6191 100644 --- a/src/Rector/v7/v4/MoveLanguageFilesFromRemovedCmsExtensionRector.php +++ b/src/Rector/v7/v4/MoveLanguageFilesFromRemovedCmsExtensionRector.php @@ -65,7 +65,7 @@ public function refactor(Node $node): ?Node { $value = $this->valueResolver->getValue($node); - if (null === $value || ! is_string($value)) { + if ($value === null || ! is_string($value)) { return null; } diff --git a/src/Rector/v7/v5/UseExtPrefixForTcaIconFileRector.php b/src/Rector/v7/v5/UseExtPrefixForTcaIconFileRector.php index cd85c3863..988a5a1d7 100644 --- a/src/Rector/v7/v5/UseExtPrefixForTcaIconFileRector.php +++ b/src/Rector/v7/v5/UseExtPrefixForTcaIconFileRector.php @@ -132,7 +132,7 @@ private function refactorIconFile(ArrayItem $fieldValue): void $extensionKey = $this->valueResolver->getValue($staticCall->args[0]->value); - if (null === $extensionKey) { + if ($extensionKey === null) { return; } @@ -143,7 +143,7 @@ private function refactorIconFile(ArrayItem $fieldValue): void $pathToFile = $this->valueResolver->getValue($pathToFileNode); - if (null === $pathToFile) { + if ($pathToFile === null) { return; } @@ -156,7 +156,7 @@ private function refactorIconFile(ArrayItem $fieldValue): void $pathToFile = $this->valueResolver->getValue($fieldValue->value); - if (null === $pathToFile) { + if ($pathToFile === null) { return; } diff --git a/src/Rector/v7/v6/MigrateT3editorWizardToRenderTypeT3editorRector.php b/src/Rector/v7/v6/MigrateT3editorWizardToRenderTypeT3editorRector.php index 670c466ad..530fd12db 100644 --- a/src/Rector/v7/v6/MigrateT3editorWizardToRenderTypeT3editorRector.php +++ b/src/Rector/v7/v6/MigrateT3editorWizardToRenderTypeT3editorRector.php @@ -121,7 +121,7 @@ public function refactor(Node $node): ?Node $fieldName = $this->valueResolver->getValue($fieldValue->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } @@ -233,7 +233,7 @@ public function refactor(Node $node): ?Node } } - if (0 === $remainingWizards) { + if ($remainingWizards === 0) { $this->removeNode($configItemValue); $hasAstBeenChanged = true; } diff --git a/src/Rector/v7/v6/RemoveIconOptionForRenderTypeSelectRector.php b/src/Rector/v7/v6/RemoveIconOptionForRenderTypeSelectRector.php index 551df4d2c..ac98a619d 100644 --- a/src/Rector/v7/v6/RemoveIconOptionForRenderTypeSelectRector.php +++ b/src/Rector/v7/v6/RemoveIconOptionForRenderTypeSelectRector.php @@ -107,7 +107,7 @@ public function refactor(Node $node): ?Node $fieldName = $this->valueResolver->getValue($fieldValue->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } @@ -164,16 +164,16 @@ public function refactor(Node $node): ?Node continue; } - if (null === $renderType || 'selectSingle' !== $renderType) { + if ($renderType === null || $renderType !== 'selectSingle') { continue; } - if (null !== $selicon_cols && null === $showIconTable) { + if ($selicon_cols !== null && $showIconTable === null) { $configValue->value->items[] = new ArrayItem($this->nodeFactory->createTrue(), new String_( self::SHOW_ICON_TABLE )); $hasAstBeenChanged = true; - } elseif (! $noIconsBelowSelect && null === $showIconTable) { + } elseif (! $noIconsBelowSelect && $showIconTable === null) { $configValue->value->items[] = new ArrayItem($this->nodeFactory->createTrue(), new String_( self::SHOW_ICON_TABLE )); diff --git a/src/Rector/v8/v0/GetFileAbsFileNameRemoveDeprecatedArgumentsRector.php b/src/Rector/v8/v0/GetFileAbsFileNameRemoveDeprecatedArgumentsRector.php index 9af95e1d7..ee62d2a6d 100644 --- a/src/Rector/v8/v0/GetFileAbsFileNameRemoveDeprecatedArgumentsRector.php +++ b/src/Rector/v8/v0/GetFileAbsFileNameRemoveDeprecatedArgumentsRector.php @@ -41,7 +41,7 @@ public function refactor(Node $node): ?Node return null; } - if (1 === count($node->args)) { + if (count($node->args) === 1) { return null; } diff --git a/src/Rector/v8/v0/RefactorRemovedMarkerMethodsFromHtmlParserRector.php b/src/Rector/v8/v0/RefactorRemovedMarkerMethodsFromHtmlParserRector.php index 964c9abd5..75bc09935 100644 --- a/src/Rector/v8/v0/RefactorRemovedMarkerMethodsFromHtmlParserRector.php +++ b/src/Rector/v8/v0/RefactorRemovedMarkerMethodsFromHtmlParserRector.php @@ -145,7 +145,7 @@ public function removeMethods($call): void { if ($this->isNames($call->name, self::REMOVED_METHODS)) { $methodName = $this->getName($call->name); - if (null !== $methodName) { + if ($methodName !== null) { try { $this->removeNode($call); } catch (ShouldNotHappenException $shouldNotHappenException) { @@ -163,7 +163,7 @@ public function renameMethod($call): void { if ($this->isName($call->name, self::RENAMED_METHOD)) { $methodName = $this->getName($call->name); - if (null !== $methodName) { + if ($methodName !== null) { $call->name = new Identifier('HTMLcleaner'); } } @@ -176,7 +176,7 @@ private function migrateMethodsToMarkerBasedTemplateService($call): ?Node { if ($this->isNames($call->name, self::MOVED_METHODS_TO_MARKER_BASED_TEMPLATES)) { $methodName = $this->getName($call->name); - if (null !== $methodName) { + if ($methodName !== null) { $classConstant = $this->nodeFactory->createClassConstReference( 'TYPO3\CMS\Core\Service\MarkerBasedTemplateService' ); diff --git a/src/Rector/v8/v0/RefactorRemovedMethodsFromGeneralUtilityRector.php b/src/Rector/v8/v0/RefactorRemovedMethodsFromGeneralUtilityRector.php index b48e3c7dd..a3b4729e5 100644 --- a/src/Rector/v8/v0/RefactorRemovedMethodsFromGeneralUtilityRector.php +++ b/src/Rector/v8/v0/RefactorRemovedMethodsFromGeneralUtilityRector.php @@ -43,11 +43,11 @@ public function refactor(Node $node): ?Node } $methodName = $this->getName($node->name); - if (null === $methodName) { + if ($methodName === null) { return null; } - if ('gif_compress' === $methodName) { + if ($methodName === 'gif_compress') { return $this->nodeFactory->createStaticCall( 'TYPO3\CMS\Core\Imaging\GraphicalFunctions', 'gifCompress', @@ -55,7 +55,7 @@ public function refactor(Node $node): ?Node ); } - if ('png_to_gif_by_imagemagick' === $methodName) { + if ($methodName === 'png_to_gif_by_imagemagick') { return $this->nodeFactory->createStaticCall( 'TYPO3\CMS\Core\Imaging\GraphicalFunctions', 'pngToGifByImagemagick', @@ -63,7 +63,7 @@ public function refactor(Node $node): ?Node ); } - if ('read_png_gif' === $methodName) { + if ($methodName === 'read_png_gif') { return $this->nodeFactory->createStaticCall( 'TYPO3\CMS\Core\Imaging\GraphicalFunctions', 'readPngGif', @@ -71,13 +71,13 @@ public function refactor(Node $node): ?Node ); } - if ('array_merge' === $methodName) { + if ($methodName === 'array_merge') { [$arg1, $arg2] = $node->args; return new Plus($arg1->value, $arg2->value); } - if ('cleanOutputBuffers' === $methodName) { + if ($methodName === 'cleanOutputBuffers') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Utility\GeneralUtility', 'flushOutputBuffers'); } diff --git a/src/Rector/v8/v0/RemoveLangCsConvObjAndParserFactoryRector.php b/src/Rector/v8/v0/RemoveLangCsConvObjAndParserFactoryRector.php index a2947d140..362c6e057 100644 --- a/src/Rector/v8/v0/RemoveLangCsConvObjAndParserFactoryRector.php +++ b/src/Rector/v8/v0/RemoveLangCsConvObjAndParserFactoryRector.php @@ -97,7 +97,7 @@ private function shouldSkip($node): bool private function isLanguageServiceCall(Node $node): bool { - if (! (property_exists($node, 'var') && null !== $node->var)) { + if (! (property_exists($node, 'var') && $node->var !== null)) { return false; } @@ -114,13 +114,13 @@ private function isLanguageServiceCall(Node $node): bool private function refactorLanguageServiceCall(Node $node): ?StaticCall { - if (! (property_exists($node, 'name') && null !== $node->name)) { + if (! (property_exists($node, 'name') && $node->name !== null)) { return null; } $nodeName = $this->getName($node->name); - if (null === $nodeName) { + if ($nodeName === null) { return null; } diff --git a/src/Rector/v8/v0/RemoveRteHtmlParserEvalWriteFileRector.php b/src/Rector/v8/v0/RemoveRteHtmlParserEvalWriteFileRector.php index 5af01bf50..b41f4090a 100644 --- a/src/Rector/v8/v0/RemoveRteHtmlParserEvalWriteFileRector.php +++ b/src/Rector/v8/v0/RemoveRteHtmlParserEvalWriteFileRector.php @@ -42,7 +42,7 @@ public function refactor(Node $node): ?Node if ($this->isName($node->name, 'evalWriteFile')) { $methodName = $this->getName($node->name); - if (null === $methodName) { + if ($methodName === null) { return null; } diff --git a/src/Rector/v8/v0/TimeTrackerGlobalsToSingletonRector.php b/src/Rector/v8/v0/TimeTrackerGlobalsToSingletonRector.php index 14b42858a..c9bd4927f 100644 --- a/src/Rector/v8/v0/TimeTrackerGlobalsToSingletonRector.php +++ b/src/Rector/v8/v0/TimeTrackerGlobalsToSingletonRector.php @@ -51,7 +51,7 @@ public function refactor(Node $node): ?Node [$classConstant] ); $methodCallName = $this->getName($node->name); - if (null === $methodCallName) { + if ($methodCallName === null) { return null; } diff --git a/src/Rector/v8/v0/TimeTrackerInsteadOfNullTimeTrackerRector.php b/src/Rector/v8/v0/TimeTrackerInsteadOfNullTimeTrackerRector.php index 16a9d6faa..1852d9db8 100644 --- a/src/Rector/v8/v0/TimeTrackerInsteadOfNullTimeTrackerRector.php +++ b/src/Rector/v8/v0/TimeTrackerInsteadOfNullTimeTrackerRector.php @@ -80,7 +80,7 @@ private function addAdditionalArgumentIfNeeded(Node $node): ?Node $value = $this->valueResolver->getValue($node->args[0]->value); - if ('TYPO3\CMS\Core\TimeTracker\NullTimeTracker' !== $value) { + if ($value !== 'TYPO3\CMS\Core\TimeTracker\NullTimeTracker') { return null; } diff --git a/src/Rector/v8/v1/RefactorDbConstantsRector.php b/src/Rector/v8/v1/RefactorDbConstantsRector.php index 6264c9096..26123003c 100644 --- a/src/Rector/v8/v1/RefactorDbConstantsRector.php +++ b/src/Rector/v8/v1/RefactorDbConstantsRector.php @@ -43,7 +43,7 @@ public function getNodeTypes(): array public function refactor(Node $node): ?Node { $constantsName = $this->getName($node); - if (null === $constantsName) { + if ($constantsName === null) { return null; } diff --git a/src/Rector/v8/v1/RefactorVariousGeneralUtilityMethodsRector.php b/src/Rector/v8/v1/RefactorVariousGeneralUtilityMethodsRector.php index f6c4f8fa2..10a2107ca 100644 --- a/src/Rector/v8/v1/RefactorVariousGeneralUtilityMethodsRector.php +++ b/src/Rector/v8/v1/RefactorVariousGeneralUtilityMethodsRector.php @@ -107,7 +107,7 @@ public function refactor(Node $node): ?Node $nodeName = $this->getName($node->name); - if (self::COMPAT_VERSION === $nodeName) { + if ($nodeName === self::COMPAT_VERSION) { return new GreaterOrEqual( $this->nodeFactory->createStaticCall( 'TYPO3\CMS\Core\Utility\VersionNumberUtility', @@ -122,7 +122,7 @@ public function refactor(Node $node): ?Node ); } - if (self::CONVERT_MICROTIME === $nodeName) { + if ($nodeName === self::CONVERT_MICROTIME) { $funcCall = $this->nodeFactory->createFuncCall('explode', [new String_(' '), $node->args[0]->value]); $this->nodesToAddCollector->addNodeBeforeNode( new Expression(new Assign(new Variable(self::PARTS), $funcCall)), @@ -137,7 +137,7 @@ public function refactor(Node $node): ?Node ]); } - if (self::RAW_URL_ENCODE_JS === $nodeName) { + if ($nodeName === self::RAW_URL_ENCODE_JS) { return $this->nodeFactory->createFuncCall('str_replace', [ '%20', ' ', @@ -145,7 +145,7 @@ public function refactor(Node $node): ?Node ]); } - if (self::RAW_URL_ENCODE_FP === $nodeName) { + if ($nodeName === self::RAW_URL_ENCODE_FP) { return $this->nodeFactory->createFuncCall('str_replace', [ '%2F', '/', @@ -153,11 +153,11 @@ public function refactor(Node $node): ?Node ]); } - if (self::LCFIRST === $nodeName) { + if ($nodeName === self::LCFIRST) { return $this->nodeFactory->createFuncCall(self::LCFIRST, $node->args); } - if (self::GET_MAXIMUM_PATH_LENGTH === $nodeName) { + if ($nodeName === self::GET_MAXIMUM_PATH_LENGTH) { return new ConstFetch(new Name('PHP_MAXPATHLEN')); } diff --git a/src/Rector/v8/v1/TypoScriptFrontendControllerCharsetConverterRector.php b/src/Rector/v8/v1/TypoScriptFrontendControllerCharsetConverterRector.php index 9de2a0b82..a781b7c8e 100644 --- a/src/Rector/v8/v1/TypoScriptFrontendControllerCharsetConverterRector.php +++ b/src/Rector/v8/v1/TypoScriptFrontendControllerCharsetConverterRector.php @@ -125,7 +125,7 @@ private function refactorMethodCsConv(MethodCall $methodCall): Node { $from = isset($methodCall->args[1]) ? $this->valueResolver->getValue($methodCall->args[1]->value) : null; - if ('' === $from || 'null' === $from || null === $from) { + if ($from === '' || $from === 'null' || $from === null) { return $methodCall->args[0]->value; } @@ -158,7 +158,7 @@ private function refactorCsConvObj(MethodCall $methodCall): ?Node $this->addCharsetConverterNode($methodCall); $methodName = $this->getName($methodCall->name); - if (null === $methodName) { + if ($methodName === null) { return null; } diff --git a/src/Rector/v8/v2/UseHtmlSpecialCharsDirectlyForTranslationRector.php b/src/Rector/v8/v2/UseHtmlSpecialCharsDirectlyForTranslationRector.php index 7b65d718d..56f093fd6 100644 --- a/src/Rector/v8/v2/UseHtmlSpecialCharsDirectlyForTranslationRector.php +++ b/src/Rector/v8/v2/UseHtmlSpecialCharsDirectlyForTranslationRector.php @@ -146,14 +146,14 @@ private function refactorToHtmlSpecialChars(MethodCall $methodCall, int $argumen $hsc = $this->valueResolver->getValue($methodCall->args[$argumentPosition]->value); - if (null === $hsc) { + if ($hsc === null) { return null; } // If you donĀ“t unset it you will end up in an infinite loop here unset($methodCall->args[$argumentPosition]); - if (false === $hsc) { + if ($hsc === false) { return null; } diff --git a/src/Rector/v8/v3/SoftReferencesFunctionalityRemovedRector.php b/src/Rector/v8/v3/SoftReferencesFunctionalityRemovedRector.php index 026c7def4..485d5eaea 100644 --- a/src/Rector/v8/v3/SoftReferencesFunctionalityRemovedRector.php +++ b/src/Rector/v8/v3/SoftReferencesFunctionalityRemovedRector.php @@ -81,7 +81,7 @@ public function refactor(Node $node): ?Node } $configFieldName = $this->valueResolver->getValue($configValue->key); - if ('config' !== $configFieldName) { + if ($configFieldName !== 'config') { continue; } @@ -100,7 +100,7 @@ public function refactor(Node $node): ?Node $configItemValueValue = $this->valueResolver->getValue($configItemValue->value); - if (null === $configItemValueValue) { + if ($configItemValueValue === null) { continue; } @@ -118,7 +118,7 @@ public function refactor(Node $node): ?Node } if ($changed) { - if ([] !== $softReferences) { + if ($softReferences !== []) { $softReferences = array_flip($softReferences); $configItemValue->value = new String_(implode(',', $softReferences)); } else { diff --git a/src/Rector/v8/v4/SubstituteOldWizardIconsRector.php b/src/Rector/v8/v4/SubstituteOldWizardIconsRector.php index e21d7b4a6..65fb86716 100644 --- a/src/Rector/v8/v4/SubstituteOldWizardIconsRector.php +++ b/src/Rector/v8/v4/SubstituteOldWizardIconsRector.php @@ -79,7 +79,7 @@ public function refactor(Node $node): ?Node $fieldName = $this->valueResolver->getValue($fieldValue->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } diff --git a/src/Rector/v8/v5/CharsetConverterToMultiByteFunctionsRector.php b/src/Rector/v8/v5/CharsetConverterToMultiByteFunctionsRector.php index d92257b5a..c70c97d74 100644 --- a/src/Rector/v8/v5/CharsetConverterToMultiByteFunctionsRector.php +++ b/src/Rector/v8/v5/CharsetConverterToMultiByteFunctionsRector.php @@ -39,31 +39,31 @@ public function refactor(Node $node): ?Node $nodeName = $this->getName($node->name); - if (null === $nodeName) { + if ($nodeName === null) { return null; } - if ('strlen' === $nodeName) { + if ($nodeName === 'strlen') { return $this->toMultiByteStrlen($node); } - if ('convCapitalize' === $nodeName) { + if ($nodeName === 'convCapitalize') { return $this->toMultiByteConvertCase($node); } - if ('substr' === $nodeName) { + if ($nodeName === 'substr') { return $this->toMultiByteSubstr($node); } - if ('conv_case' === $nodeName) { + if ($nodeName === 'conv_case') { return $this->toMultiByteLowerUpperCase($node); } - if ('utf8_strpos' === $nodeName) { + if ($nodeName === 'utf8_strpos') { return $this->toMultiByteStrPos($node); } - if ('utf8_strrpos' === $nodeName) { + if ($nodeName === 'utf8_strrpos') { return $this->toMultiByteStrrPos($node); } @@ -132,9 +132,9 @@ private function toMultiByteSubstr(MethodCall $methodCall): FuncCall private function toMultiByteLowerUpperCase(MethodCall $methodCall): FuncCall { - $mbMethodCall = 'toLower' === $this->valueResolver->getValue( + $mbMethodCall = $this->valueResolver->getValue( $methodCall->args[2]->value - ) ? 'mb_strtolower' : 'mb_strtoupper'; + ) === 'toLower' ? 'mb_strtolower' : 'mb_strtoupper'; return $this->nodeFactory->createFuncCall($mbMethodCall, [$methodCall->args[1], $methodCall->args[0]]); } diff --git a/src/Rector/v8/v6/MigrateLastPiecesOfDefaultExtrasRector.php b/src/Rector/v8/v6/MigrateLastPiecesOfDefaultExtrasRector.php index 636f129d2..cf59d433b 100644 --- a/src/Rector/v8/v6/MigrateLastPiecesOfDefaultExtrasRector.php +++ b/src/Rector/v8/v6/MigrateLastPiecesOfDefaultExtrasRector.php @@ -220,13 +220,13 @@ private function refactorDefaultExtras(Array_ $columnItemsArray): void $defaultExtrasArray = ArrayUtility::trimExplode(':', $defaultExtras, true); foreach ($defaultExtrasArray as $defaultExtrasSetting) { - if ('nowrap' === $defaultExtrasSetting) { + if ($defaultExtrasSetting === 'nowrap') { $additionalConfigItems[] = new ArrayItem(new String_('off'), new String_('wrap')); - } elseif ('enable-tab' === $defaultExtrasSetting) { + } elseif ($defaultExtrasSetting === 'enable-tab') { $additionalConfigItems[] = new ArrayItem($this->nodeFactory->createTrue(), new String_( 'enableTabulator' )); - } elseif ('fixed-font' === $defaultExtrasSetting) { + } elseif ($defaultExtrasSetting === 'fixed-font') { $additionalConfigItems[] = new ArrayItem($this->nodeFactory->createTrue(), new String_( 'fixedFont' )); @@ -237,7 +237,7 @@ private function refactorDefaultExtras(Array_ $columnItemsArray): void $this->removeNode($configValue); } - if ([] !== $additionalConfigItems) { + if ($additionalConfigItems !== []) { $this->hasAstBeenChanged = true; $config = $this->extractArrayItemByKey($columnItem->value, 'config'); diff --git a/src/Rector/v8/v6/MigrateOptionsOfTypeGroupRector.php b/src/Rector/v8/v6/MigrateOptionsOfTypeGroupRector.php index 3c36a5d25..6d1ec93bb 100644 --- a/src/Rector/v8/v6/MigrateOptionsOfTypeGroupRector.php +++ b/src/Rector/v8/v6/MigrateOptionsOfTypeGroupRector.php @@ -77,13 +77,13 @@ public function refactor(Node $node): ?Node $hasAstBeenChanged = $this->refactorShowThumbs($config) ? true : $hasAstBeenChanged; $hasAstBeenChanged = $this->refactorDisableControls($config) ? true : $hasAstBeenChanged; - if ([] !== $this->addFieldControls) { + if ($this->addFieldControls !== []) { $config->items[] = new ArrayItem($this->nodeFactory->createArray( $this->addFieldControls ), new String_('fieldControl')); } - if ([] !== $this->addFieldWizards) { + if ($this->addFieldWizards !== []) { $config->items[] = new ArrayItem($this->nodeFactory->createArray( $this->addFieldWizards ), new String_('fieldWizard')); @@ -180,16 +180,16 @@ private function refactorDisableControls(Array_ $configArray): bool if (is_string($this->getValue($disableControls->value))) { $controls = ArrayUtility::trimExplode(',', $this->getValue($disableControls->value), true); foreach ($controls as $control) { - if ('browser' === $control) { + if ($control === 'browser') { $this->addFieldControls['elementBrowser'][self::DISABLED] = true; - } elseif ('delete' === $control) { + } elseif ($control === 'delete') { $configArray->items[] = new ArrayItem( $this->nodeFactory->createTrue(), new String_('hideDeleteIcon') ); - } elseif ('allowedTables' === $control) { + } elseif ($control === 'allowedTables') { $this->addFieldWizards['tableList'][self::DISABLED] = true; - } elseif ('upload' === $control) { + } elseif ($control === 'upload') { $this->addFieldWizards['fileUpload'][self::DISABLED] = true; } } diff --git a/src/Rector/v8/v6/MigrateSpecialConfigurationAndRemoveShowItemStylePointerConfigRector.php b/src/Rector/v8/v6/MigrateSpecialConfigurationAndRemoveShowItemStylePointerConfigRector.php index 72fa4c75c..2f960faf1 100644 --- a/src/Rector/v8/v6/MigrateSpecialConfigurationAndRemoveShowItemStylePointerConfigRector.php +++ b/src/Rector/v8/v6/MigrateSpecialConfigurationAndRemoveShowItemStylePointerConfigRector.php @@ -142,7 +142,7 @@ protected function refactorType(Expr $typeKey, Expr $typeConfiguration): void $fieldName = $fieldArray[self::FIELD_NAME]; - if (null !== $fieldArray[self::FIELD_EXTRA]) { + if ($fieldArray[self::FIELD_EXTRA] !== null) { // Move fieldExtra "specConf" to columnsOverrides "defaultExtras" // Merge with given defaultExtras from columns. // They will be the first part of the string, so if "specConf" from types changes the same settings, @@ -154,7 +154,7 @@ protected function refactorType(Expr $typeKey, Expr $typeConfiguration): void $newDefaultExtras[] = $fieldArray[self::FIELD_EXTRA]; $newDefaultExtrasString = trim(implode(':', $newDefaultExtras)); - if ('' !== $newDefaultExtrasString) { + if ($newDefaultExtrasString !== '') { $columnsOverridesArray = $this->extractSubArrayByKey($typeConfiguration, 'columnsOverrides'); if (! $columnsOverridesArray instanceof Array_) { $columnsOverridesArray = new Array_([]); @@ -177,21 +177,21 @@ protected function refactorType(Expr $typeKey, Expr $typeConfiguration): void } unset($fieldArray[self::FIELD_EXTRA]); - if (3 === count($fieldArray) && '' === ($fieldArray[self::PALETTE_NAME] ?? '')) { + if (count($fieldArray) === 3 && '' === ($fieldArray[self::PALETTE_NAME] ?? '')) { unset($fieldArray[self::PALETTE_NAME]); } - if (2 === count($fieldArray) && '' === ($fieldArray[self::FIELD_LABEL] ?? '')) { + if (count($fieldArray) === 2 && '' === ($fieldArray[self::FIELD_LABEL] ?? '')) { unset($fieldArray[self::FIELD_LABEL]); } - if (1 === count($fieldArray) && '' === $fieldArray[self::FIELD_NAME]) { + if (count($fieldArray) === 1 && $fieldArray[self::FIELD_NAME] === '') { // The field may vanish if nothing is left unset($fieldArray[self::FIELD_NAME]); } $newFieldString = implode(';', $fieldArray); - if ('' !== $newFieldString) { + if ($newFieldString !== '') { $newFieldStrings[] = $newFieldString; } } diff --git a/src/Rector/v8/v6/MoveRequestUpdateOptionFromControlToColumnsRector.php b/src/Rector/v8/v6/MoveRequestUpdateOptionFromControlToColumnsRector.php index 1fee627f5..bfec1d1fd 100644 --- a/src/Rector/v8/v6/MoveRequestUpdateOptionFromControlToColumnsRector.php +++ b/src/Rector/v8/v6/MoveRequestUpdateOptionFromControlToColumnsRector.php @@ -65,7 +65,7 @@ public function refactor(Node $node): ?Node if ($this->valueResolver->isValue($fieldValue->key, 'requestUpdate')) { $fields = $this->valueResolver->getValue($fieldValue->value); - if (null === $fields) { + if ($fields === null) { return null; } @@ -74,7 +74,7 @@ public function refactor(Node $node): ?Node } } - if ([] === $requestUpdateFields) { + if ($requestUpdateFields === []) { return null; } diff --git a/src/Rector/v8/v6/RefactorTCARector.php b/src/Rector/v8/v6/RefactorTCARector.php index 98afa1fe6..673eb8eab 100644 --- a/src/Rector/v8/v6/RefactorTCARector.php +++ b/src/Rector/v8/v6/RefactorTCARector.php @@ -154,13 +154,13 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): continue; } - if (null === $fieldValue->key) { + if ($fieldValue->key === null) { continue; } $fieldName = $this->valueResolver->getValue($fieldValue->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } @@ -191,7 +191,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): continue; } - if (null === $configItemValue->key) { + if ($configItemValue->key === null) { continue; } @@ -238,7 +238,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): $wizardItemValueKey = $this->valueResolver->getValue($wizardItemValueKey); - if (null === $wizardItemValueKey) { + if ($wizardItemValueKey === null) { continue; } @@ -246,7 +246,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): if (array_key_exists($wizardItemValueKey, self::MAP_WIZARD_TO_FIELD_CONTROL)) { $fieldControlKey = self::MAP_WIZARD_TO_FIELD_CONTROL[$wizardItemValueKey]; - if ('link' !== $wizardItemValueKey) { + if ($wizardItemValueKey !== 'link') { $fieldControl[$fieldControlKey] = [ 'disabled' => false, ]; @@ -256,7 +256,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): if (array_key_exists( $wizardItemValueKey, self::MAP_WIZARD_TO_RENDER_TYPE - ) && null === $this->extractArrayItemByKey($configValueArray, 'renderType')) { + ) && $this->extractArrayItemByKey($configValueArray, 'renderType') === null) { $configValueArray->items[] = new ArrayItem(new String_( self::MAP_WIZARD_TO_RENDER_TYPE[$wizardItemValueKey] ), new String_('renderType')); @@ -269,12 +269,12 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): continue; } - if (null === $wizardItemSubValue->key) { + if ($wizardItemSubValue->key === null) { continue; } // Configuration of slider wizard - if ('angle' === $wizardItemValueKey && ! $this->valueResolver->isValue( + if ($wizardItemValueKey === 'angle' && ! $this->valueResolver->isValue( $wizardItemSubValue->key, 'type' )) { @@ -284,7 +284,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): $wizardItemSubValue->key )] = $sliderValue; } - } elseif ('select' === $wizardItemValueKey && $this->valueResolver->isValue( + } elseif ($wizardItemValueKey === 'select' && $this->valueResolver->isValue( $wizardItemSubValue->key, 'items' )) { @@ -302,16 +302,16 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): continue; } - if (null === $paramsValue->key) { + if ($paramsValue->key === null) { continue; } $value = $this->valueResolver->getValue($paramsValue->value); - if (null === $value) { + if ($value === null) { continue; } - if (null !== $fieldControlKey && $this->valueResolver->isValues($paramsValue->key, [ + if ($fieldControlKey !== null && $this->valueResolver->isValues($paramsValue->key, [ 'table', 'pid', 'setValue', @@ -321,20 +321,20 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): 'allowedExtensions', ])) { $paramsValueKey = $this->valueResolver->getValue($paramsValue->key); - if (null !== $paramsValueKey) { - if ('JSopenParams' === $paramsValueKey) { + if ($paramsValueKey !== null) { + if ($paramsValueKey === 'JSopenParams') { $paramsValueKey = 'windowOpenParameters'; } $fieldControl[$fieldControlKey]['options'][$paramsValueKey] = $value; } } } - } elseif (null !== $fieldControlKey && $this->valueResolver->isValue( + } elseif ($fieldControlKey !== null && $this->valueResolver->isValue( $wizardItemSubValue->key, 'title' )) { $value = $this->valueResolver->getValue($wizardItemSubValue->value); - if (null === $value) { + if ($value === null) { continue; } $fieldControl[$fieldControlKey]['options'][$this->valueResolver->getValue( @@ -343,22 +343,22 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): } } - if ([] !== $selectOptions && null === $this->extractArrayItemByKey( + if ($selectOptions !== [] && $this->extractArrayItemByKey( $configValueArray, self::MAP_WIZARD_TO_CUSTOM_TYPE['select'] - )) { + ) === null) { $configValueArray->items[] = new ArrayItem($this->nodeFactory->createArray( $selectOptions ), new String_(self::MAP_WIZARD_TO_CUSTOM_TYPE['select'])); } - if ([] !== $customTypeOptions && array_key_exists( + if ($customTypeOptions !== [] && array_key_exists( $wizardItemValueKey, self::MAP_WIZARD_TO_CUSTOM_TYPE - ) && null === $this->extractArrayItemByKey( + ) && $this->extractArrayItemByKey( $configValueArray, self::MAP_WIZARD_TO_CUSTOM_TYPE[$wizardItemValueKey] - )) { + ) === null) { $configValueArray->items[] = new ArrayItem($this->nodeFactory->createArray( $customTypeOptions ), new String_(self::MAP_WIZARD_TO_CUSTOM_TYPE[$wizardItemValueKey])); @@ -367,13 +367,13 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): $existingFieldControl = $this->extractArrayItemByKey($configValueArray, 'fieldControl'); - if (null === $existingFieldControl && [] !== $fieldControl) { + if ($existingFieldControl === null && $fieldControl !== []) { $configValueArray->items[] = new ArrayItem($this->nodeFactory->createArray( $fieldControl ), new String_('fieldControl')); - } elseif ([] !== $fieldControl && $existingFieldControl instanceof ArrayItem) { + } elseif ($fieldControl !== [] && $existingFieldControl instanceof ArrayItem) { foreach ($fieldControl as $fieldControlKey => $fieldControlValue) { - if (null !== $this->extractArrayItemByKey($existingFieldControl->value, $fieldControlKey)) { + if ($this->extractArrayItemByKey($existingFieldControl->value, $fieldControlKey) !== null) { continue; } @@ -387,7 +387,7 @@ private function addFieldControlInsteadOfWizardsAddListEdit(Array_ $itemsArray): } } - if (0 === $remainingWizards) { + if ($remainingWizards === 0) { $this->removeNode($configItemValue); } } @@ -406,7 +406,7 @@ private function refactorRenderTypeInputDateTime(ArrayItem $configValueArrayItem continue; } - if (null === $configItemValue->key) { + if ($configItemValue->key === null) { continue; } @@ -416,7 +416,7 @@ private function refactorRenderTypeInputDateTime(ArrayItem $configValueArrayItem $eval = $this->valueResolver->getValue($configItemValue->value); - if (null === $eval) { + if ($eval === null) { continue; } diff --git a/src/Rector/v8/v6/RemoveL10nModeNoCopyRector.php b/src/Rector/v8/v6/RemoveL10nModeNoCopyRector.php index 6b8af2a40..13c9b76a2 100644 --- a/src/Rector/v8/v6/RemoveL10nModeNoCopyRector.php +++ b/src/Rector/v8/v6/RemoveL10nModeNoCopyRector.php @@ -153,7 +153,7 @@ public function refactor(Node $node): ?Node $addAllowLanguageSynchronization = false; - if ('' === (string) $this->valueResolver->getValue($behaviourConfiguration->value)) { + if ((string) $this->valueResolver->getValue($behaviourConfiguration->value) === '') { $behaviourConfiguration->value = $this->nodeFactory->createTrue(); $hasAstBeenChanged = true; } diff --git a/src/Rector/v8/v7/BackendUtilityGetRecordsByFieldToQueryBuilderRector.php b/src/Rector/v8/v7/BackendUtilityGetRecordsByFieldToQueryBuilderRector.php index 0188ed8cc..10cd61147 100644 --- a/src/Rector/v8/v7/BackendUtilityGetRecordsByFieldToQueryBuilderRector.php +++ b/src/Rector/v8/v7/BackendUtilityGetRecordsByFieldToQueryBuilderRector.php @@ -139,11 +139,11 @@ private function addQueryBuilderNode(StaticCall $staticCall, Node $positionNode) $tableArgument = $staticCall->args[0]; - if (! $queryBuilderArgument instanceof Arg || 'null' === $this->valueResolver->getValue( + if (! $queryBuilderArgument instanceof Arg || $this->valueResolver->getValue( $queryBuilderArgument->value - )) { + ) === 'null') { $table = $this->valueResolver->getValue($tableArgument->value); - if (null === $table) { + if ($table === null) { $table = $tableArgument; } @@ -211,11 +211,11 @@ private function addQueryBuilderDeletedRestrictionNode( Node $positionNode ): void { $useDeleteClauseArgument = $node->args[7] ?? null; - $useDeleteClause = null !== $useDeleteClauseArgument ? $this->valueResolver->getValue( + $useDeleteClause = $useDeleteClauseArgument !== null ? $this->valueResolver->getValue( $useDeleteClauseArgument->value ) : true; - if (false === $useDeleteClause) { + if ($useDeleteClause === false) { return; } @@ -286,9 +286,9 @@ private function addQueryWhereNode( Node $positionNode ): void { $whereClauseArgument = $staticCall->args[3] ?? null; - $whereClause = null !== $whereClauseArgument ? $this->valueResolver->getValue($whereClauseArgument->value) : ''; + $whereClause = $whereClauseArgument !== null ? $this->valueResolver->getValue($whereClauseArgument->value) : ''; - if ('' === $whereClause) { + if ($whereClause === '') { return; } @@ -322,9 +322,9 @@ private function addQueryGroupByNode( Node $positionNode ): void { $groupByArgument = $staticCall->args[4] ?? null; - $groupBy = null !== $groupByArgument ? $this->valueResolver->getValue($groupByArgument->value) : ''; + $groupBy = $groupByArgument !== null ? $this->valueResolver->getValue($groupByArgument->value) : ''; - if ('' === $groupBy) { + if ($groupBy === '') { return; } @@ -355,9 +355,9 @@ private function addQueryGroupByNode( private function addOrderByNode(string $queryBuilderVariableName, StaticCall $staticCall, Node $positionNode): void { $orderByArgument = $staticCall->args[5] ?? null; - $orderBy = null !== $orderByArgument ? $this->valueResolver->getValue($orderByArgument->value) : ''; + $orderBy = $orderByArgument !== null ? $this->valueResolver->getValue($orderByArgument->value) : ''; - if ('' === $orderBy || 'null' === $orderBy) { + if ($orderBy === '' || $orderBy === 'null') { return; } @@ -400,9 +400,9 @@ private function addOrderByNode(string $queryBuilderVariableName, StaticCall $st private function addLimitNode(string $queryBuilderVariableName, StaticCall $staticCall, Node $positionNode): void { $limitArgument = $staticCall->args[6] ?? null; - $limit = null !== $limitArgument ? $this->valueResolver->getValue($limitArgument->value) : ''; + $limit = $limitArgument !== null ? $this->valueResolver->getValue($limitArgument->value) : ''; - if ('' === $limit) { + if ($limit === '') { return; } diff --git a/src/Rector/v8/v7/ChangeAttemptsParameterConsoleOutputRector.php b/src/Rector/v8/v7/ChangeAttemptsParameterConsoleOutputRector.php index 9dca65c35..0c46cd799 100644 --- a/src/Rector/v8/v7/ChangeAttemptsParameterConsoleOutputRector.php +++ b/src/Rector/v8/v7/ChangeAttemptsParameterConsoleOutputRector.php @@ -64,9 +64,9 @@ public function refactor(Node $node): ?Node $nodeNameArgument2 = isset($arguments[2]) ? $this->getName($arguments[2]->value) : ''; $nodeNameArgument4 = isset($arguments[4]) ? $this->getName($arguments[4]->value) : ''; - if ($this->isName($node->name, self::ASK_AND_VALIDATE) && 'false' === $nodeNameArgument2) { + if ($this->isName($node->name, self::ASK_AND_VALIDATE) && $nodeNameArgument2 === 'false') { $arguments[2] = null; - } elseif ($this->isName($node->name, self::SELECT) && 'false' === $nodeNameArgument4) { + } elseif ($this->isName($node->name, self::SELECT) && $nodeNameArgument4 === 'false') { $arguments[4] = null; } diff --git a/src/Rector/v8/v7/DataHandlerVariousMethodsAndMethodArgumentsRector.php b/src/Rector/v8/v7/DataHandlerVariousMethodsAndMethodArgumentsRector.php index ac062e5ae..fa260b5e8 100644 --- a/src/Rector/v8/v7/DataHandlerVariousMethodsAndMethodArgumentsRector.php +++ b/src/Rector/v8/v7/DataHandlerVariousMethodsAndMethodArgumentsRector.php @@ -54,7 +54,7 @@ public function refactor(Node $node): ?Node return new Concat(new ConstFetch(new Name('PATH_site')), $firstArgument->value); } - if ($this->isName($node->name, 'extFileFunctions') && 4 === count($node->args)) { + if ($this->isName($node->name, 'extFileFunctions') && count($node->args) === 4) { $this->removeNode($node->args[3]); return $node; } diff --git a/src/Rector/v8/v7/RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector.php b/src/Rector/v8/v7/RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector.php index 6ac5fffba..7704e096e 100644 --- a/src/Rector/v8/v7/RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector.php +++ b/src/Rector/v8/v7/RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector.php @@ -115,13 +115,13 @@ private function refactorMethodCall(MethodCall $methodCall): ?Node return null; } - if ([] === $methodCall->args) { + if ($methodCall->args === []) { return null; } $argumentValue = $this->valueResolver->getValue($methodCall->args[0]->value); - if (null === $argumentValue) { + if ($argumentValue === null) { return null; } diff --git a/src/Rector/v8/v7/RefactorRemovedMarkerMethodsFromContentObjectRendererRector.php b/src/Rector/v8/v7/RefactorRemovedMarkerMethodsFromContentObjectRendererRector.php index a4d999e1d..33d25043d 100644 --- a/src/Rector/v8/v7/RefactorRemovedMarkerMethodsFromContentObjectRendererRector.php +++ b/src/Rector/v8/v7/RefactorRemovedMarkerMethodsFromContentObjectRendererRector.php @@ -86,7 +86,7 @@ public function refactor(Node $node): ?Node ] )) { $methodName = $this->getName($node->name); - if (null === $methodName) { + if ($methodName === null) { return null; } diff --git a/src/Rector/v8/v7/RemoveLocalizationModeKeepIfNeededRector.php b/src/Rector/v8/v7/RemoveLocalizationModeKeepIfNeededRector.php index 9b8c1e243..335b4cd31 100644 --- a/src/Rector/v8/v7/RemoveLocalizationModeKeepIfNeededRector.php +++ b/src/Rector/v8/v7/RemoveLocalizationModeKeepIfNeededRector.php @@ -68,7 +68,7 @@ public function refactor(Node $node): ?Node $fieldName = $this->valueResolver->getValue($columnItem->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } @@ -209,6 +209,6 @@ private function isLocalizationModeKeepAndAllowLanguageSynchronization(Array_ $b } } - return $allowLanguageSynchronization && 'keep' === $localizationMode; + return $allowLanguageSynchronization && $localizationMode === 'keep'; } } diff --git a/src/Rector/v9/v0/DatabaseConnectionToDbalRector.php b/src/Rector/v9/v0/DatabaseConnectionToDbalRector.php index a24f681cc..63473bb12 100644 --- a/src/Rector/v9/v0/DatabaseConnectionToDbalRector.php +++ b/src/Rector/v9/v0/DatabaseConnectionToDbalRector.php @@ -67,7 +67,7 @@ public function refactor(Node $node): ?Node } $methodName = $this->getName($node->name); - if (null === $methodName) { + if ($methodName === null) { return null; } diff --git a/src/Rector/v9/v0/MetaTagManagementRector.php b/src/Rector/v9/v0/MetaTagManagementRector.php index e35b96d9e..de84cc962 100644 --- a/src/Rector/v9/v0/MetaTagManagementRector.php +++ b/src/Rector/v9/v0/MetaTagManagementRector.php @@ -95,7 +95,7 @@ private function parseMetaTag(string $metaTag): array { $out = Strings::matchAll($metaTag, self::PATTERN); - if ([] === $out) { + if ($out === []) { return []; } @@ -163,7 +163,7 @@ private function createSetMetaTagMethod(MethodCall $methodCall): ?MethodCall private function createXUCompatibleMetaTag(MethodCall $methodCall): MethodCall { $value = 'IE=8'; - if ([] !== $methodCall->args) { + if ($methodCall->args !== []) { $value = $methodCall->args[0]->value; } diff --git a/src/Rector/v9/v0/MoveRenderArgumentsToInitializeArgumentsMethodRector.php b/src/Rector/v9/v0/MoveRenderArgumentsToInitializeArgumentsMethodRector.php index b95ffb66f..2128162da 100644 --- a/src/Rector/v9/v0/MoveRenderArgumentsToInitializeArgumentsMethodRector.php +++ b/src/Rector/v9/v0/MoveRenderArgumentsToInitializeArgumentsMethodRector.php @@ -82,7 +82,7 @@ public function refactor(Node $node): ?Node return null; } - if ([] === $renderMethod->getParams()) { + if ($renderMethod->getParams() === []) { return null; } diff --git a/src/Rector/v9/v0/RefactorBackendUtilityGetPagesTSconfigRector.php b/src/Rector/v9/v0/RefactorBackendUtilityGetPagesTSconfigRector.php index a314658dc..34d2d4f5d 100644 --- a/src/Rector/v9/v0/RefactorBackendUtilityGetPagesTSconfigRector.php +++ b/src/Rector/v9/v0/RefactorBackendUtilityGetPagesTSconfigRector.php @@ -50,12 +50,12 @@ public function refactor(Node $node): ?Node $returnPartArray = $this->valueResolver->getValue($node->args[2]->value); // If a custom non default rootline is given, nothing can be done - if ('null' !== $rootLine) { + if ($rootLine !== 'null') { return null; } // Just remove the arguments if equals to default ones - if (false === $returnPartArray) { + if ($returnPartArray === false) { $node->args = [$node->args[0]]; return null; diff --git a/src/Rector/v9/v0/RefactorDeprecationLogRector.php b/src/Rector/v9/v0/RefactorDeprecationLogRector.php index 64163da7e..70245761d 100644 --- a/src/Rector/v9/v0/RefactorDeprecationLogRector.php +++ b/src/Rector/v9/v0/RefactorDeprecationLogRector.php @@ -40,7 +40,7 @@ public function getNodeTypes(): array public function refactor(Node $node): ?Node { $className = $this->getName($node->class); - if ('TYPO3\CMS\Core\Utility\GeneralUtility' !== $className) { + if ($className !== 'TYPO3\CMS\Core\Utility\GeneralUtility') { return null; } diff --git a/src/Rector/v9/v0/RefactorMethodsFromExtensionManagementUtilityRector.php b/src/Rector/v9/v0/RefactorMethodsFromExtensionManagementUtilityRector.php index d15ef15bc..9990b16f3 100644 --- a/src/Rector/v9/v0/RefactorMethodsFromExtensionManagementUtilityRector.php +++ b/src/Rector/v9/v0/RefactorMethodsFromExtensionManagementUtilityRector.php @@ -32,23 +32,23 @@ public function refactor(Node $node): ?Node { $className = $this->getName($node->class); $methodName = $this->getName($node->name); - if ('TYPO3\CMS\Core\Utility\ExtensionManagementUtility' !== $className) { + if ($className !== 'TYPO3\CMS\Core\Utility\ExtensionManagementUtility') { return null; } - if (null === $methodName) { + if ($methodName === null) { return null; } - if ('isLoaded' === $methodName) { + if ($methodName === 'isLoaded') { return $this->removeSecondArgumentFromMethodIsLoaded($node); } - if ('siteRelPath' === $methodName) { + if ($methodName === 'siteRelPath') { return $this->createNewMethodCallForSiteRelPath($node); } - if ('removeCacheFiles' === $methodName) { + if ($methodName === 'removeCacheFiles') { return $this->createNewMethodCallForRemoveCacheFiles(); } diff --git a/src/Rector/v9/v0/RemoveOptionLocalizeChildrenAtParentLocalizationRector.php b/src/Rector/v9/v0/RemoveOptionLocalizeChildrenAtParentLocalizationRector.php index 61deca852..a59adb454 100644 --- a/src/Rector/v9/v0/RemoveOptionLocalizeChildrenAtParentLocalizationRector.php +++ b/src/Rector/v9/v0/RemoveOptionLocalizeChildrenAtParentLocalizationRector.php @@ -63,7 +63,7 @@ public function refactor(Node $node): ?Node $fieldName = $this->valueResolver->getValue($columnItem->key); - if (null === $fieldName) { + if ($fieldName === null) { continue; } diff --git a/src/Rector/v9/v0/ReplaceExtKeyWithExtensionKeyRector.php b/src/Rector/v9/v0/ReplaceExtKeyWithExtensionKeyRector.php index 2c3f62886..c7aaa5fa4 100644 --- a/src/Rector/v9/v0/ReplaceExtKeyWithExtensionKeyRector.php +++ b/src/Rector/v9/v0/ReplaceExtKeyWithExtensionKeyRector.php @@ -100,7 +100,7 @@ public function refactor(Node $node): ?Node $extensionKey = $this->resolveExtensionKeyByComposerJson($extEmConf); - if (null === $extensionKey) { + if ($extensionKey === null) { $extensionKey = basename($extEmConf->getRealPathDirectory()); } diff --git a/src/Rector/v9/v0/UseNewComponentIdForPageTreeRector.php b/src/Rector/v9/v0/UseNewComponentIdForPageTreeRector.php index d7e58500b..80afa2bf3 100644 --- a/src/Rector/v9/v0/UseNewComponentIdForPageTreeRector.php +++ b/src/Rector/v9/v0/UseNewComponentIdForPageTreeRector.php @@ -69,11 +69,11 @@ public function refactor(Node $node): ?Node continue; } - if ('navigationComponentId' !== $this->valueResolver->getValue($item->key)) { + if ($this->valueResolver->getValue($item->key) !== 'navigationComponentId') { continue; } - if ('typo3-pagetree' !== $this->valueResolver->getValue($item->value)) { + if ($this->valueResolver->getValue($item->value) !== 'typo3-pagetree') { continue; } diff --git a/src/Rector/v9/v2/GeneralUtilityGetUrlRequestHeadersRector.php b/src/Rector/v9/v2/GeneralUtilityGetUrlRequestHeadersRector.php index 9aa452f0e..b53517636 100644 --- a/src/Rector/v9/v2/GeneralUtilityGetUrlRequestHeadersRector.php +++ b/src/Rector/v9/v2/GeneralUtilityGetUrlRequestHeadersRector.php @@ -73,7 +73,7 @@ public function refactor(Node $node): ?Node $newHeaders = $this->buildHeaders($requestHeaders); - if ([] === $newHeaders) { + if ($newHeaders === []) { return null; } @@ -91,11 +91,11 @@ private function buildHeaders(array $requestHeaders): array $newHeaders = []; foreach ($requestHeaders as $requestHeader) { $parts = preg_split('#:[ \t]*#', (string) $requestHeader, 2, PREG_SPLIT_NO_EMPTY); - if (false === $parts) { + if ($parts === false) { continue; } - if (2 !== count($parts)) { + if (count($parts) !== 2) { continue; } diff --git a/src/Rector/v9/v2/PageNotFoundAndErrorHandlingRector.php b/src/Rector/v9/v2/PageNotFoundAndErrorHandlingRector.php index 0f9c3b6b9..e9e87caae 100644 --- a/src/Rector/v9/v2/PageNotFoundAndErrorHandlingRector.php +++ b/src/Rector/v9/v2/PageNotFoundAndErrorHandlingRector.php @@ -176,7 +176,7 @@ private function createResponse(MethodCall $methodCall): ?Node { $methodCallName = $this->getName($methodCall->name); - if (null === $methodCallName) { + if ($methodCallName === null) { return null; } @@ -253,12 +253,12 @@ private function refactorPageErrorHandlerIfPossible(MethodCall $methodCall): ?No $code = $this->valueResolver->getValue($methodCall->args[0]->value); - if (null === $code) { + if ($code === null) { return null; } $message = null; - if ('1' === (string) $code || is_bool($code) || 'true' === strtolower((string) $code)) { + if ((string) $code === '1' || is_bool($code) || strtolower((string) $code) === 'true') { $message = new String_('The page did not exist or was inaccessible.'); if (isset($methodCall->args[2])) { $reason = $methodCall->args[2]->value; @@ -271,7 +271,7 @@ private function refactorPageErrorHandlerIfPossible(MethodCall $methodCall): ?No } } - if ('' === $code) { + if ($code === '') { $message = new String_('Page cannot be found.'); if (isset($methodCall->args[2])) { $reason = $methodCall->args[2]->value; @@ -281,7 +281,7 @@ private function refactorPageErrorHandlerIfPossible(MethodCall $methodCall): ?No } } - if (null !== $message) { + if ($message !== null) { return new Echo_([ $this->nodeFactory->createMethodCall( $this->nodeFactory->createStaticCall( diff --git a/src/Rector/v9/v2/RenameMethodCallToEnvironmentMethodCallRector.php b/src/Rector/v9/v2/RenameMethodCallToEnvironmentMethodCallRector.php index de2cf7599..031307a63 100644 --- a/src/Rector/v9/v2/RenameMethodCallToEnvironmentMethodCallRector.php +++ b/src/Rector/v9/v2/RenameMethodCallToEnvironmentMethodCallRector.php @@ -53,15 +53,15 @@ public function refactor(Node $node): ?Node { $className = $this->getName($node->class); $methodName = $this->getName($node->name); - if ('TYPO3\CMS\Core\Core\Bootstrap' === $className && 'usesComposerClassLoading' === $methodName) { + if ($className === 'TYPO3\CMS\Core\Core\Bootstrap' && $methodName === 'usesComposerClassLoading') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'isComposerMode'); } - if ('TYPO3\CMS\Core\Utility\GeneralUtility' === $className && 'getApplicationContext' === $methodName) { + if ($className === 'TYPO3\CMS\Core\Utility\GeneralUtility' && $methodName === 'getApplicationContext') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'getContext'); } - if ('TYPO3\CMS\Extbase\Service\EnvironmentService' === $className && 'isEnvironmentInCliMode' === $methodName) { + if ($className === 'TYPO3\CMS\Extbase\Service\EnvironmentService' && $methodName === 'isEnvironmentInCliMode') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'isCli'); } diff --git a/src/Rector/v9/v3/RefactorTsConfigRelatedMethodsRector.php b/src/Rector/v9/v3/RefactorTsConfigRelatedMethodsRector.php index c0683a3d9..930da7d12 100644 --- a/src/Rector/v9/v3/RefactorTsConfigRelatedMethodsRector.php +++ b/src/Rector/v9/v3/RefactorTsConfigRelatedMethodsRector.php @@ -86,11 +86,11 @@ public function refactor(Node $node): ?Node $value = $this->valueResolver->getValue($node->args[0]->value); - if (null === $value) { + if ($value === null) { return null; } - if (! is_string($value) || '' === $value) { + if (! is_string($value) || $value === '') { return null; } diff --git a/src/Rector/v9/v4/ConstantsToEnvironmentApiCallRector.php b/src/Rector/v9/v4/ConstantsToEnvironmentApiCallRector.php index 9beaa7a2e..2f834d3a9 100644 --- a/src/Rector/v9/v4/ConstantsToEnvironmentApiCallRector.php +++ b/src/Rector/v9/v4/ConstantsToEnvironmentApiCallRector.php @@ -71,7 +71,7 @@ public function refactor(Node $node): ?Node private function refactorConstants(ConstFetch $node): ?Node { $constantName = $this->getName($node); - if (null === $constantName) { + if ($constantName === null) { return null; } @@ -95,22 +95,22 @@ private function refactorConstants(ConstFetch $node): ?Node return null; } - if ('PATH_thisScript' === $constantName) { + if ($constantName === 'PATH_thisScript') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'getCurrentScript'); } - if ('PATH_site' === $constantName) { + if ($constantName === 'PATH_site') { return new Concat($this->nodeFactory->createStaticCall( 'TYPO3\CMS\Core\Core\Environment', 'getPublicPath' ), new String_('/')); } - if ('PATH_typo3' === $constantName) { + if ($constantName === 'PATH_typo3') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'getBackendPath'); } - if ('PATH_typo3conf' === $constantName) { + if ($constantName === 'PATH_typo3conf') { return $this->nodeFactory->createStaticCall('TYPO3\CMS\Core\Core\Environment', 'getLegacyConfigPath'); } diff --git a/src/Rector/v9/v4/SystemEnvironmentBuilderConstantsRector.php b/src/Rector/v9/v4/SystemEnvironmentBuilderConstantsRector.php index 7fb90f61c..19fe1e007 100644 --- a/src/Rector/v9/v4/SystemEnvironmentBuilderConstantsRector.php +++ b/src/Rector/v9/v4/SystemEnvironmentBuilderConstantsRector.php @@ -59,7 +59,7 @@ public function getNodeTypes(): array public function refactor(Node $node): ?Node { $constantsName = $this->getName($node); - if (null === $constantsName) { + if ($constantsName === null) { return null; } @@ -73,13 +73,13 @@ public function refactor(Node $node): ?Node return $this->nodeFactory->createClassConstFetch('TYPO3\CMS\Core\Service\AbstractService', $value); } - if ('SUB' === $constantsName) { + if ($constantsName === 'SUB') { return $this->nodeFactory->createFuncCall('chr', [(int) $value]); } $string = new String_($value); - if ('TAB' === $constantsName || 'NUL' === $constantsName) { + if ($constantsName === 'TAB' || $constantsName === 'NUL') { $string->setAttribute(AttributeKey::KIND, String_::KIND_DOUBLE_QUOTED); } diff --git a/src/Rector/v9/v4/UseClassSchemaInsteadReflectionServiceMethodsRector.php b/src/Rector/v9/v4/UseClassSchemaInsteadReflectionServiceMethodsRector.php index 858f2d410..f63110607 100644 --- a/src/Rector/v9/v4/UseClassSchemaInsteadReflectionServiceMethodsRector.php +++ b/src/Rector/v9/v4/UseClassSchemaInsteadReflectionServiceMethodsRector.php @@ -136,49 +136,49 @@ public function refactor(Node $node): ?Node return null; } - if ([] === $node->args) { + if ($node->args === []) { return null; } $nodeName = $this->getName($node->name); - if (null === $nodeName) { + if ($nodeName === null) { return null; } - if ('getClassPropertyNames' === $nodeName) { + if ($nodeName === 'getClassPropertyNames') { return $this->refactorGetClassPropertyNamesMethod($node); } - if ('getPropertyTagsValues' === $nodeName) { + if ($nodeName === 'getPropertyTagsValues') { return $this->refactorGetPropertyTagsValuesMethod($node); } - if ('getPropertyTagValues' === $nodeName) { + if ($nodeName === 'getPropertyTagValues') { return $this->refactorGetPropertyTagValuesMethod($node); } - if ('getClassTagsValues' === $nodeName) { + if ($nodeName === 'getClassTagsValues') { return $this->refactorGetClassTagsValues($node); } - if ('getClassTagValues' === $nodeName) { + if ($nodeName === 'getClassTagValues') { return $this->refactorGetClassTagValues($node); } - if ('getMethodTagsValues' === $nodeName) { + if ($nodeName === 'getMethodTagsValues') { return $this->refactorGetMethodTagsValues($node); } - if (self::HAS_METHOD === $nodeName) { + if ($nodeName === self::HAS_METHOD) { return $this->refactorHasMethod($node); } - if ('getMethodParameters' === $nodeName) { + if ($nodeName === 'getMethodParameters') { return $this->refactorGetMethodParameters($node); } - if ('isClassTaggedWith' === $nodeName) { + if ($nodeName === 'isClassTaggedWith') { return $this->refactorIsClassTaggedWith($node); } diff --git a/src/Rector/v9/v4/UseContextApiRector.php b/src/Rector/v9/v4/UseContextApiRector.php index 61bb13907..8cf9d3399 100644 --- a/src/Rector/v9/v4/UseContextApiRector.php +++ b/src/Rector/v9/v4/UseContextApiRector.php @@ -67,31 +67,31 @@ public function refactor(Node $node): ?Node $contextCall = $this->nodeFactory->createMethodCall($staticCall, 'getPropertyFromAspect'); - if ('loginUser' === $propertyName) { + if ($propertyName === 'loginUser') { $contextCall->args = $this->nodeFactory->createArgs(['frontend.user', 'isLoggedIn']); return $contextCall; } - if ('gr_list' === $propertyName) { + if ($propertyName === 'gr_list') { $contextCall->args = $this->nodeFactory->createArgs(['frontend.user', 'groupIds']); return $this->nodeFactory->createFuncCall('implode', [new String_(','), $contextCall]); } - if ('beUserLogin' === $propertyName) { + if ($propertyName === 'beUserLogin') { $contextCall->args = $this->nodeFactory->createArgs(['backend.user', 'isLoggedIn']); return $contextCall; } - if ('showHiddenPage' === $propertyName) { + if ($propertyName === 'showHiddenPage') { $contextCall->args = $this->nodeFactory->createArgs(['visibility', 'includeHiddenPages']); return $contextCall; } - if ('showHiddenRecords' === $propertyName) { + if ($propertyName === 'showHiddenRecords') { $contextCall->args = $this->nodeFactory->createArgs(['visibility', 'includeHiddenContent']); return $contextCall; diff --git a/src/Rector/v9/v4/UseLanguageAspectForTsfeLanguagePropertiesRector.php b/src/Rector/v9/v4/UseLanguageAspectForTsfeLanguagePropertiesRector.php index dfa2c662f..79eaddafd 100644 --- a/src/Rector/v9/v4/UseLanguageAspectForTsfeLanguagePropertiesRector.php +++ b/src/Rector/v9/v4/UseLanguageAspectForTsfeLanguagePropertiesRector.php @@ -72,7 +72,7 @@ public function refactor(Node $node): ?Node $nodeName = $this->getName($node->name); - if (null === $nodeName) { + if ($nodeName === null) { return null; } diff --git a/src/Rector/v9/v5/ExtbaseCommandControllerToSymfonyCommandRector.php b/src/Rector/v9/v5/ExtbaseCommandControllerToSymfonyCommandRector.php index 97f7c61c2..6c08e308d 100644 --- a/src/Rector/v9/v5/ExtbaseCommandControllerToSymfonyCommandRector.php +++ b/src/Rector/v9/v5/ExtbaseCommandControllerToSymfonyCommandRector.php @@ -150,7 +150,7 @@ public function refactor(Node $node): ?Node } $commandClassMethods = $this->findCommandMethods($node); - if ([] === $commandClassMethods) { + if ($commandClassMethods === []) { return null; } @@ -158,7 +158,7 @@ public function refactor(Node $node): ?Node return null; } - if ([] === $node->namespacedName->parts) { + if ($node->namespacedName->parts === []) { return null; } @@ -191,11 +191,11 @@ public function refactor(Node $node): ?Node $commandMethodName = $this->getName($commandMethod->name); - if (null === $commandMethodName) { + if ($commandMethodName === null) { continue; } - if (null === $commandMethod->stmts) { + if ($commandMethod->stmts === null) { continue; } @@ -383,7 +383,7 @@ private function createInputArguments(array $methodParameters, array $paramTags) $methodParamName = $this->nodeNameResolver->getName($methodParameter->var); - if (null === $methodParamName) { + if ($methodParamName === null) { continue; } diff --git a/src/TypeInferer/ParamTypeInferer/FunctionLikeDocParamTypeInferer.php b/src/TypeInferer/ParamTypeInferer/FunctionLikeDocParamTypeInferer.php index 6cbd7be05..c4f45b8c9 100644 --- a/src/TypeInferer/ParamTypeInferer/FunctionLikeDocParamTypeInferer.php +++ b/src/TypeInferer/ParamTypeInferer/FunctionLikeDocParamTypeInferer.php @@ -71,7 +71,7 @@ public function inferParam(Param $param): Type $paramTypesByName[$paramTagValueNode->parameterName] = $parameterType; } - if ([] === $paramTypesByName) { + if ($paramTypesByName === []) { return new MixedType(); } diff --git a/src/ValueObject/Indent.php b/src/ValueObject/Indent.php index 5d2c37ada..09e091d58 100644 --- a/src/ValueObject/Indent.php +++ b/src/ValueObject/Indent.php @@ -30,7 +30,7 @@ private function __construct(string $value) public static function fromFile(File $file): self { - if (1 === \preg_match('#^(?P( +|\t+)).*#m', $file->getFileContent(), $match)) { + if (\preg_match('#^(?P( +|\t+)).*#m', $file->getFileContent(), $match) === 1) { return self::fromString($match['indent']); } @@ -44,7 +44,7 @@ public function toString(): string public function isSpace(): bool { - return 1 === \preg_match('#^( +).*#', $this->value); + return \preg_match('#^( +).*#', $this->value) === 1; } public function length(): int diff --git a/templates/rector.php.dist b/templates/rector.php.dist index 1ff9944cf..d7128ab05 100644 --- a/templates/rector.php.dist +++ b/templates/rector.php.dist @@ -10,6 +10,7 @@ use Ssch\TYPO3Rector\Configuration\Typo3Option; use Ssch\TYPO3Rector\Rector\General\ConvertImplicitVariablesToExplicitGlobalsRector; use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector; use Ssch\TYPO3Rector\Set\Typo3LevelSetList; +use Ssch\TYPO3Rector\Set\Typo3SetList; return static function (RectorConfig $rectorConfig): void { @@ -19,6 +20,8 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->sets([ Typo3LevelSetList::UP_TO_TYPO3_11, + // https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/FileStructure/Configuration/Icons.html + // Typo3SetList::REGISTER_ICONS_TO_ICON, ]); // Define your target version which you want to support diff --git a/utils/generator/src/FileSystem/ConfigFilesystem.php b/utils/generator/src/FileSystem/ConfigFilesystem.php index 3a24974b0..0af0d9818 100644 --- a/utils/generator/src/FileSystem/ConfigFilesystem.php +++ b/utils/generator/src/FileSystem/ConfigFilesystem.php @@ -77,7 +77,7 @@ public function addRuleToConfigurationFile( private function ensureRequiredKeysAreSet(array $templateVariables): void { $missingKeys = array_diff(self::REQUIRED_KEYS, array_keys($templateVariables)); - if ([] === $missingKeys) { + if ($missingKeys === []) { return; } diff --git a/utils/phpstan/src/Rules/AddCodeCoverageIgnoreForRectorDefinitionRule.php b/utils/phpstan/src/Rules/AddCodeCoverageIgnoreForRectorDefinitionRule.php index 4392b4db2..6048437e5 100644 --- a/utils/phpstan/src/Rules/AddCodeCoverageIgnoreForRectorDefinitionRule.php +++ b/utils/phpstan/src/Rules/AddCodeCoverageIgnoreForRectorDefinitionRule.php @@ -56,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array $methodName = $node->name->toString(); - if ('getRuleDefinition' !== $methodName) { + if ($methodName !== 'getRuleDefinition') { return []; } diff --git a/utils/phpstan/src/Type/ContextGetAspectDynamicReturnTypeExtension.php b/utils/phpstan/src/Type/ContextGetAspectDynamicReturnTypeExtension.php index 37dc266be..df54637a1 100644 --- a/utils/phpstan/src/Type/ContextGetAspectDynamicReturnTypeExtension.php +++ b/utils/phpstan/src/Type/ContextGetAspectDynamicReturnTypeExtension.php @@ -22,7 +22,7 @@ public function getClass(): string public function isMethodSupported(MethodReflection $methodReflection): bool { - return 'getAspect' === $methodReflection->getName(); + return $methodReflection->getName() === 'getAspect'; } public function getTypeFromMethodCall( @@ -32,7 +32,7 @@ public function getTypeFromMethodCall( ): Type { $defaultObjectType = new ObjectType('TYPO3\CMS\Core\Context\AspectInterface'); - if (null === $methodCall->args) { + if ($methodCall->args === null) { return $defaultObjectType; } diff --git a/utils/phpstan/src/Type/GeneralUtilityDynamicReturnTypeExtension.php b/utils/phpstan/src/Type/GeneralUtilityDynamicReturnTypeExtension.php index 4f54a06ab..34ea9fd17 100644 --- a/utils/phpstan/src/Type/GeneralUtilityDynamicReturnTypeExtension.php +++ b/utils/phpstan/src/Type/GeneralUtilityDynamicReturnTypeExtension.php @@ -24,7 +24,7 @@ public function getClass(): string public function isStaticMethodSupported(MethodReflection $methodReflection): bool { - return 'makeInstance' === $methodReflection->getName(); + return $methodReflection->getName() === 'makeInstance'; } public function getTypeFromStaticMethodCall( diff --git a/utils/phpstan/src/Type/ObjectManagerDynamicReturnTypeExtension.php b/utils/phpstan/src/Type/ObjectManagerDynamicReturnTypeExtension.php index ccb3f0b5a..5422c405a 100644 --- a/utils/phpstan/src/Type/ObjectManagerDynamicReturnTypeExtension.php +++ b/utils/phpstan/src/Type/ObjectManagerDynamicReturnTypeExtension.php @@ -30,7 +30,7 @@ public function getClass(): string public function isMethodSupported(MethodReflection $methodReflection): bool { - return 'get' === $methodReflection->getName(); + return $methodReflection->getName() === 'get'; } public function getTypeFromMethodCall( diff --git a/utils/phpstan/src/Type/ValidatorResolverDynamicReturnTypeExtension.php b/utils/phpstan/src/Type/ValidatorResolverDynamicReturnTypeExtension.php index 77c3646f5..781942085 100644 --- a/utils/phpstan/src/Type/ValidatorResolverDynamicReturnTypeExtension.php +++ b/utils/phpstan/src/Type/ValidatorResolverDynamicReturnTypeExtension.php @@ -30,7 +30,7 @@ public function getClass(): string public function isMethodSupported(MethodReflection $methodReflection): bool { - return 'createValidator' === $methodReflection->getName(); + return $methodReflection->getName() === 'createValidator'; } public function getTypeFromMethodCall(