From d7cc05415b6c6fcd5f8da86ede5a048d77c6aa4f Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 27 Sep 2024 16:04:31 +0100 Subject: [PATCH 1/5] Require a strict_types declaration --- Magento2/ruleset.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Magento2/ruleset.xml b/Magento2/ruleset.xml index 4ac058c0..fd8b619b 100644 --- a/Magento2/ruleset.xml +++ b/Magento2/ruleset.xml @@ -471,6 +471,10 @@ 7 warning + + 7 + warning + From 49e2e23f910bcd31260e7b189f0511b1b8c73815 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 27 Sep 2024 16:32:51 +0100 Subject: [PATCH 2/5] Correct phpcs directive --- Magento2/Tests/Eslint/AbstractEslintTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Magento2/Tests/Eslint/AbstractEslintTestCase.php b/Magento2/Tests/Eslint/AbstractEslintTestCase.php index 5e1f4fc1..8425d71c 100644 --- a/Magento2/Tests/Eslint/AbstractEslintTestCase.php +++ b/Magento2/Tests/Eslint/AbstractEslintTestCase.php @@ -24,7 +24,7 @@ abstract class AbstractEslintTestCase extends TestCase */ protected function assertFileContainsError(string $testFile, array $expectedMessages): void { - // phpcs:disable + // phpcs:ignore Magento2.Security.InsecureFunction.FoundWithAlternative exec( 'npm run eslint -- Magento2/Tests/Eslint/' . $testFile, $output From 02b640a3bef65b2ec7126ce0be486352debba418 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 27 Sep 2024 16:33:19 +0100 Subject: [PATCH 3/5] Skip test when NPM is not installed --- Magento2/Tests/Eslint/AbstractEslintTestCase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Magento2/Tests/Eslint/AbstractEslintTestCase.php b/Magento2/Tests/Eslint/AbstractEslintTestCase.php index 8425d71c..417a95e3 100644 --- a/Magento2/Tests/Eslint/AbstractEslintTestCase.php +++ b/Magento2/Tests/Eslint/AbstractEslintTestCase.php @@ -7,6 +7,7 @@ namespace Magento2\Tests\Eslint; +use PHP_CodeSniffer\Config; use PHPUnit\Framework\TestCase; /** @@ -24,6 +25,10 @@ abstract class AbstractEslintTestCase extends TestCase */ protected function assertFileContainsError(string $testFile, array $expectedMessages): void { + if (Config::getExecutablePath('npm') === null) { + $this->markTestSkipped('npm is not installed here'); + } + // phpcs:ignore Magento2.Security.InsecureFunction.FoundWithAlternative exec( 'npm run eslint -- Magento2/Tests/Eslint/' . $testFile, From 5e2f01dab59dd8abfe3e425dcca9a4513b56f480 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 27 Sep 2024 16:46:24 +0100 Subject: [PATCH 4/5] Enable strict type checking --- Magento2/Helpers/Commenting/PHPDocFormattingValidator.php | 2 ++ Magento2/Helpers/Tokenizer/AbstractTokenizer.php | 2 ++ Magento2/Helpers/Tokenizer/Parameter.php | 2 ++ Magento2/Helpers/Tokenizer/Variable.php | 1 + Magento2/Sniffs/Classes/AbstractApiSniff.php | 2 ++ Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php | 2 ++ Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php | 2 ++ .../Commenting/ClassAndInterfacePHPDocFormattingSniff.php | 2 ++ .../Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php | 2 ++ Magento2/Sniffs/Exceptions/DirectThrowSniff.php | 2 ++ Magento2/Sniffs/Exceptions/ThrowCatchSniff.php | 1 + .../Sniffs/Exceptions/TryProcessSystemResourcesSniff.php | 2 ++ Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php | 2 ++ Magento2/Sniffs/Functions/StaticFunctionSniff.php | 2 ++ Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php | 2 ++ Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php | 1 + Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php | 1 + Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php | 2 ++ Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php | 2 ++ Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php | 2 ++ Magento2/Sniffs/Html/HtmlBindingSniff.php | 1 + Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php | 1 + Magento2/Sniffs/Legacy/DiConfigSniff.php | 1 + Magento2/Sniffs/Legacy/EmailTemplateSniff.php | 1 + Magento2/Sniffs/Legacy/MageEntitySniff.php | 2 ++ Magento2/Sniffs/Legacy/ModuleXMLSniff.php | 1 + Magento2/Sniffs/Legacy/ObsoleteAclSniff.php | 2 ++ Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php | 1 + Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php | 4 +++- .../Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php | 7 ++++--- Magento2/Sniffs/Legacy/WidgetXMLSniff.php | 1 + Magento2/Sniffs/Legacy/_files/restricted_classes.php | 1 + Magento2/Sniffs/Less/AvoidIdSniff.php | 2 ++ Magento2/Sniffs/Less/BracesFormattingSniff.php | 2 ++ Magento2/Sniffs/Less/ClassNamingSniff.php | 2 ++ Magento2/Sniffs/Less/ColonSpacingSniff.php | 2 ++ Magento2/Sniffs/Less/ColourDefinitionSniff.php | 2 ++ Magento2/Sniffs/Less/CombinatorIndentationSniff.php | 2 ++ Magento2/Sniffs/Less/CommentLevelsSniff.php | 2 ++ Magento2/Sniffs/Less/ImportantPropertySniff.php | 2 ++ Magento2/Sniffs/Less/IndentationSniff.php | 2 ++ Magento2/Sniffs/Less/PropertiesLineBreakSniff.php | 2 ++ Magento2/Sniffs/Less/PropertiesSortingSniff.php | 2 ++ Magento2/Sniffs/Less/QuotesSniff.php | 2 ++ Magento2/Sniffs/Less/SelectorDelimiterSniff.php | 2 ++ Magento2/Sniffs/Less/SemicolonSpacingSniff.php | 2 ++ Magento2/Sniffs/Less/TokenizerSymbolsInterface.php | 2 ++ Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php | 2 ++ Magento2/Sniffs/Less/TypeSelectorsSniff.php | 2 ++ Magento2/Sniffs/Less/VariablesSniff.php | 2 ++ Magento2/Sniffs/Less/ZeroUnitsSniff.php | 2 ++ Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php | 2 ++ .../Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php | 2 ++ Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php | 2 ++ Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php | 2 ++ Magento2/Sniffs/PHP/FinalImplementationSniff.php | 2 ++ Magento2/Sniffs/PHP/GotoSniff.php | 2 ++ Magento2/Sniffs/PHP/LiteralNamespacesSniff.php | 2 ++ Magento2/Sniffs/PHP/ReturnValueCheckSniff.php | 2 ++ Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php | 2 ++ Magento2/Sniffs/PHP/VarSniff.php | 2 ++ Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php | 2 ++ Magento2/Sniffs/SQL/RawQuerySniff.php | 2 ++ Magento2/Sniffs/Security/IncludeFileSniff.php | 2 ++ Magento2/Sniffs/Security/InsecureFunctionSniff.php | 2 ++ Magento2/Sniffs/Security/LanguageConstructSniff.php | 2 ++ Magento2/Sniffs/Security/SuperglobalSniff.php | 2 ++ Magento2/Sniffs/Security/XssTemplateSniff.php | 2 ++ Magento2/Sniffs/Strings/ExecutableRegExSniff.php | 2 ++ Magento2/Sniffs/Strings/StringConcatSniff.php | 2 ++ Magento2/Sniffs/Templates/ThisInTemplateSniff.php | 2 ++ Magento2/Sniffs/Translation/ConstantUsageSniff.php | 2 ++ Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php | 2 ++ 73 files changed, 137 insertions(+), 4 deletions(-) diff --git a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php index a87312d5..9ea66b5a 100644 --- a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php +++ b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php @@ -4,6 +4,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Helpers\Commenting; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Helpers/Tokenizer/AbstractTokenizer.php b/Magento2/Helpers/Tokenizer/AbstractTokenizer.php index 1a3c4a63..c024ab80 100644 --- a/Magento2/Helpers/Tokenizer/AbstractTokenizer.php +++ b/Magento2/Helpers/Tokenizer/AbstractTokenizer.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Helpers\Tokenizer; /** diff --git a/Magento2/Helpers/Tokenizer/Parameter.php b/Magento2/Helpers/Tokenizer/Parameter.php index ec3a3564..a32964df 100644 --- a/Magento2/Helpers/Tokenizer/Parameter.php +++ b/Magento2/Helpers/Tokenizer/Parameter.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Helpers\Tokenizer; /** diff --git a/Magento2/Helpers/Tokenizer/Variable.php b/Magento2/Helpers/Tokenizer/Variable.php index 43938c03..deca0489 100644 --- a/Magento2/Helpers/Tokenizer/Variable.php +++ b/Magento2/Helpers/Tokenizer/Variable.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Helpers\Tokenizer; diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index bb8a6571..276ec4f6 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Classes; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php index fbaad301..d966e176 100644 --- a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php +++ b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Classes; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php b/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php index 87c60a62..866a8bdf 100644 --- a/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php +++ b/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\CodeAnalysis; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php index b23b2858..c64f77a1 100644 --- a/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php @@ -4,6 +4,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Commenting; use Magento2\Helpers\Commenting\PHPDocFormattingValidator; diff --git a/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php index 5d715af5..ab633474 100644 --- a/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Commenting; use Magento2\Helpers\Commenting\PHPDocFormattingValidator; diff --git a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php index 576d2066..36d8f917 100644 --- a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php +++ b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Exceptions; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php index c2510168..154502ac 100644 --- a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php +++ b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Exceptions; diff --git a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php index 0fa28149..45b1d254 100644 --- a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php +++ b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Exceptions; use function array_slice; diff --git a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php index 45e00eb7..283e207d 100644 --- a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php +++ b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Functions; use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff; diff --git a/Magento2/Sniffs/Functions/StaticFunctionSniff.php b/Magento2/Sniffs/Functions/StaticFunctionSniff.php index 2ae706d0..cafdc499 100644 --- a/Magento2/Sniffs/Functions/StaticFunctionSniff.php +++ b/Magento2/Sniffs/Functions/StaticFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Functions; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php b/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php index 889e7b4a..ef861bb9 100644 --- a/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php +++ b/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php b/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php index bb7ad250..06d58eea 100644 --- a/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\GraphQL; diff --git a/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php b/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php index d009b9a0..8376f7ba 100644 --- a/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\GraphQL; diff --git a/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php b/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php index d54f8e0b..d3921875 100644 --- a/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php b/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php index f2f872fa..7ce06056 100644 --- a/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php b/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php index 602225fe..71fffb9c 100644 --- a/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Html/HtmlBindingSniff.php b/Magento2/Sniffs/Html/HtmlBindingSniff.php index cf498da1..c23ac22e 100644 --- a/Magento2/Sniffs/Html/HtmlBindingSniff.php +++ b/Magento2/Sniffs/Html/HtmlBindingSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Html; diff --git a/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php b/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php index 8798c416..6f617fa9 100644 --- a/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php +++ b/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Html; diff --git a/Magento2/Sniffs/Legacy/DiConfigSniff.php b/Magento2/Sniffs/Legacy/DiConfigSniff.php index 7495dd44..51ac1d56 100644 --- a/Magento2/Sniffs/Legacy/DiConfigSniff.php +++ b/Magento2/Sniffs/Legacy/DiConfigSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; diff --git a/Magento2/Sniffs/Legacy/EmailTemplateSniff.php b/Magento2/Sniffs/Legacy/EmailTemplateSniff.php index 85d6b9a0..626e4d57 100644 --- a/Magento2/Sniffs/Legacy/EmailTemplateSniff.php +++ b/Magento2/Sniffs/Legacy/EmailTemplateSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; diff --git a/Magento2/Sniffs/Legacy/MageEntitySniff.php b/Magento2/Sniffs/Legacy/MageEntitySniff.php index de8b7dbf..166cdb40 100644 --- a/Magento2/Sniffs/Legacy/MageEntitySniff.php +++ b/Magento2/Sniffs/Legacy/MageEntitySniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Legacy/ModuleXMLSniff.php b/Magento2/Sniffs/Legacy/ModuleXMLSniff.php index 338834a8..fd84e554 100644 --- a/Magento2/Sniffs/Legacy/ModuleXMLSniff.php +++ b/Magento2/Sniffs/Legacy/ModuleXMLSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; diff --git a/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php b/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php index 58f54910..8a478ec7 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; diff --git a/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php b/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php index efc5fae7..a889758f 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; diff --git a/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php b/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php index 1955e2e7..5927d2be 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; @@ -15,7 +17,7 @@ class ObsoleteMenuSniff implements Sniff { private const WARNING_OBSOLETE_MENU_STRUCTURE = 'ObsoleteMenuStructure'; - + /** * @var string */ diff --git a/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php b/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php index e9de6db8..ad81984d 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; @@ -41,13 +42,13 @@ public function process(File $phpcsFile, $stackPtr) $this->invalidXML($phpcsFile, $stackPtr); return; } - + $foundElements = $xml->xpath('/config/tabs|/config/sections'); - + if ($foundElements === false) { return; } - + foreach ($foundElements as $element) { $phpcsFile->addWarning( "Obsolete system configuration structure detected in file.", diff --git a/Magento2/Sniffs/Legacy/WidgetXMLSniff.php b/Magento2/Sniffs/Legacy/WidgetXMLSniff.php index aee84dc8..8724d850 100644 --- a/Magento2/Sniffs/Legacy/WidgetXMLSniff.php +++ b/Magento2/Sniffs/Legacy/WidgetXMLSniff.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento2\Sniffs\Legacy; diff --git a/Magento2/Sniffs/Legacy/_files/restricted_classes.php b/Magento2/Sniffs/Legacy/_files/restricted_classes.php index 90092aa7..b5abe4b9 100644 --- a/Magento2/Sniffs/Legacy/_files/restricted_classes.php +++ b/Magento2/Sniffs/Legacy/_files/restricted_classes.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); /** * Classes that are restricted to use directly. diff --git a/Magento2/Sniffs/Less/AvoidIdSniff.php b/Magento2/Sniffs/Less/AvoidIdSniff.php index e0c09940..e937ea60 100644 --- a/Magento2/Sniffs/Less/AvoidIdSniff.php +++ b/Magento2/Sniffs/Less/AvoidIdSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/BracesFormattingSniff.php b/Magento2/Sniffs/Less/BracesFormattingSniff.php index 54575160..2c1f1669 100644 --- a/Magento2/Sniffs/Less/BracesFormattingSniff.php +++ b/Magento2/Sniffs/Less/BracesFormattingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/ClassNamingSniff.php b/Magento2/Sniffs/Less/ClassNamingSniff.php index 3c3d1a86..29702bb1 100644 --- a/Magento2/Sniffs/Less/ClassNamingSniff.php +++ b/Magento2/Sniffs/Less/ClassNamingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/ColonSpacingSniff.php b/Magento2/Sniffs/Less/ColonSpacingSniff.php index 6b68ea65..69509fec 100644 --- a/Magento2/Sniffs/Less/ColonSpacingSniff.php +++ b/Magento2/Sniffs/Less/ColonSpacingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/ColourDefinitionSniff.php b/Magento2/Sniffs/Less/ColourDefinitionSniff.php index 945abffd..ec1a1e5f 100644 --- a/Magento2/Sniffs/Less/ColourDefinitionSniff.php +++ b/Magento2/Sniffs/Less/ColourDefinitionSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/CombinatorIndentationSniff.php b/Magento2/Sniffs/Less/CombinatorIndentationSniff.php index e6954c31..552e9fd0 100644 --- a/Magento2/Sniffs/Less/CombinatorIndentationSniff.php +++ b/Magento2/Sniffs/Less/CombinatorIndentationSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/CommentLevelsSniff.php b/Magento2/Sniffs/Less/CommentLevelsSniff.php index be7c93c9..1574d158 100644 --- a/Magento2/Sniffs/Less/CommentLevelsSniff.php +++ b/Magento2/Sniffs/Less/CommentLevelsSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Less/ImportantPropertySniff.php b/Magento2/Sniffs/Less/ImportantPropertySniff.php index ad1fd10c..c76e4505 100644 --- a/Magento2/Sniffs/Less/ImportantPropertySniff.php +++ b/Magento2/Sniffs/Less/ImportantPropertySniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/IndentationSniff.php b/Magento2/Sniffs/Less/IndentationSniff.php index 57947a07..bd7af75e 100644 --- a/Magento2/Sniffs/Less/IndentationSniff.php +++ b/Magento2/Sniffs/Less/IndentationSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php b/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php index 06eb9c6a..3886c613 100644 --- a/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php +++ b/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/PropertiesSortingSniff.php b/Magento2/Sniffs/Less/PropertiesSortingSniff.php index 2c5fe9e5..781f3b1e 100644 --- a/Magento2/Sniffs/Less/PropertiesSortingSniff.php +++ b/Magento2/Sniffs/Less/PropertiesSortingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/QuotesSniff.php b/Magento2/Sniffs/Less/QuotesSniff.php index a1328c51..29f3e70f 100644 --- a/Magento2/Sniffs/Less/QuotesSniff.php +++ b/Magento2/Sniffs/Less/QuotesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/SelectorDelimiterSniff.php b/Magento2/Sniffs/Less/SelectorDelimiterSniff.php index cdbd5117..706cc916 100644 --- a/Magento2/Sniffs/Less/SelectorDelimiterSniff.php +++ b/Magento2/Sniffs/Less/SelectorDelimiterSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/SemicolonSpacingSniff.php b/Magento2/Sniffs/Less/SemicolonSpacingSniff.php index 16783481..b5f1e7ff 100644 --- a/Magento2/Sniffs/Less/SemicolonSpacingSniff.php +++ b/Magento2/Sniffs/Less/SemicolonSpacingSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php b/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php index c640e27a..4d93142d 100644 --- a/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php +++ b/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; /** diff --git a/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php b/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php index 5b42c9b2..d774b1f4 100644 --- a/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php +++ b/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/TypeSelectorsSniff.php b/Magento2/Sniffs/Less/TypeSelectorsSniff.php index 4735c761..de5583b1 100644 --- a/Magento2/Sniffs/Less/TypeSelectorsSniff.php +++ b/Magento2/Sniffs/Less/TypeSelectorsSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/VariablesSniff.php b/Magento2/Sniffs/Less/VariablesSniff.php index ec9986a6..947cfc15 100644 --- a/Magento2/Sniffs/Less/VariablesSniff.php +++ b/Magento2/Sniffs/Less/VariablesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Less/ZeroUnitsSniff.php b/Magento2/Sniffs/Less/ZeroUnitsSniff.php index 7117bdb8..de45b80c 100644 --- a/Magento2/Sniffs/Less/ZeroUnitsSniff.php +++ b/Magento2/Sniffs/Less/ZeroUnitsSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php index 41a9f97b..dc6e79f2 100644 --- a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php +++ b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Methods; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php b/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php index 765631d4..4af245b8 100644 --- a/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php +++ b/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Namespaces; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php index a460d924..df090e32 100644 --- a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php +++ b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\NamingConvention; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php b/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php index 9c6e453a..05d7b870 100644 --- a/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php +++ b/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\NamingConvention; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/FinalImplementationSniff.php b/Magento2/Sniffs/PHP/FinalImplementationSniff.php index 15270a40..8961e447 100644 --- a/Magento2/Sniffs/PHP/FinalImplementationSniff.php +++ b/Magento2/Sniffs/PHP/FinalImplementationSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/GotoSniff.php b/Magento2/Sniffs/PHP/GotoSniff.php index 4a5f06ca..3543bf99 100644 --- a/Magento2/Sniffs/PHP/GotoSniff.php +++ b/Magento2/Sniffs/PHP/GotoSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php b/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php index d76dae3e..b16b925d 100644 --- a/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php +++ b/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php index 9929d46b..bad4325e 100644 --- a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php +++ b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php b/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php index da1aa279..0638354c 100644 --- a/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php +++ b/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/PHP/VarSniff.php b/Magento2/Sniffs/PHP/VarSniff.php index fa7b28b7..d227b65a 100644 --- a/Magento2/Sniffs/PHP/VarSniff.php +++ b/Magento2/Sniffs/PHP/VarSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\PHP; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php index 9ab6c8cc..90c56a76 100644 --- a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php +++ b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Performance; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/SQL/RawQuerySniff.php b/Magento2/Sniffs/SQL/RawQuerySniff.php index a32d4eb0..97dcef67 100644 --- a/Magento2/Sniffs/SQL/RawQuerySniff.php +++ b/Magento2/Sniffs/SQL/RawQuerySniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\SQL; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Security/IncludeFileSniff.php b/Magento2/Sniffs/Security/IncludeFileSniff.php index 567f3224..32edc81a 100644 --- a/Magento2/Sniffs/Security/IncludeFileSniff.php +++ b/Magento2/Sniffs/Security/IncludeFileSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Security; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Security/InsecureFunctionSniff.php b/Magento2/Sniffs/Security/InsecureFunctionSniff.php index 78a3e696..7795d6cd 100644 --- a/Magento2/Sniffs/Security/InsecureFunctionSniff.php +++ b/Magento2/Sniffs/Security/InsecureFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Security; use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff; diff --git a/Magento2/Sniffs/Security/LanguageConstructSniff.php b/Magento2/Sniffs/Security/LanguageConstructSniff.php index 9b10ae4a..990c85c1 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Security; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Security/SuperglobalSniff.php b/Magento2/Sniffs/Security/SuperglobalSniff.php index 136f991f..64fd5d9f 100644 --- a/Magento2/Sniffs/Security/SuperglobalSniff.php +++ b/Magento2/Sniffs/Security/SuperglobalSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Security; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Security/XssTemplateSniff.php b/Magento2/Sniffs/Security/XssTemplateSniff.php index ba200daf..3ad93ca6 100644 --- a/Magento2/Sniffs/Security/XssTemplateSniff.php +++ b/Magento2/Sniffs/Security/XssTemplateSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Security; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php index 09706ed6..0db75c4b 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Strings; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Strings/StringConcatSniff.php b/Magento2/Sniffs/Strings/StringConcatSniff.php index 89c8dc9b..04626ff9 100644 --- a/Magento2/Sniffs/Strings/StringConcatSniff.php +++ b/Magento2/Sniffs/Strings/StringConcatSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Strings; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php index 74c27a6e..60278fd4 100644 --- a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php +++ b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Templates; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Translation/ConstantUsageSniff.php b/Magento2/Sniffs/Translation/ConstantUsageSniff.php index bdf8b732..99e29ea3 100644 --- a/Magento2/Sniffs/Translation/ConstantUsageSniff.php +++ b/Magento2/Sniffs/Translation/ConstantUsageSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Translation; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php index 4d74a29e..706c5e6a 100644 --- a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php +++ b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Whitespace; use PHP_CodeSniffer\Files\File; From ef3ab208bfdb2d11a3ace4d74093012149b6fa94 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 27 Sep 2024 17:06:57 +0100 Subject: [PATCH 5/5] Add missing type-cast from SimpleXMLElement --- Magento2/Sniffs/Legacy/WidgetXMLSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Magento2/Sniffs/Legacy/WidgetXMLSniff.php b/Magento2/Sniffs/Legacy/WidgetXMLSniff.php index 8724d850..fe91a8a0 100644 --- a/Magento2/Sniffs/Legacy/WidgetXMLSniff.php +++ b/Magento2/Sniffs/Legacy/WidgetXMLSniff.php @@ -53,7 +53,7 @@ public function process(File $phpcsFile, $stackPtr) if (!property_exists($element->attributes(), 'type')) { continue; } - $type = $element['type']; + $type = (string) $element['type']; if (preg_match('/\//', $type)) { $phpcsFile->addError( "Factory name detected: {$type}.",