diff --git a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php index 1a9b77c1..ae11e246 100644 --- a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php +++ b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php @@ -4,6 +4,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 e6b81b49..ffc41ae9 100644 --- a/Magento2/Helpers/Tokenizer/AbstractTokenizer.php +++ b/Magento2/Helpers/Tokenizer/AbstractTokenizer.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Helpers\Tokenizer; /** diff --git a/Magento2/Helpers/Tokenizer/Parameter.php b/Magento2/Helpers/Tokenizer/Parameter.php index ed02038d..60cd1fd7 100644 --- a/Magento2/Helpers/Tokenizer/Parameter.php +++ b/Magento2/Helpers/Tokenizer/Parameter.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Helpers\Tokenizer; /** diff --git a/Magento2/Helpers/Tokenizer/Variable.php b/Magento2/Helpers/Tokenizer/Variable.php index 1ede8ae2..c9e0b7e4 100644 --- a/Magento2/Helpers/Tokenizer/Variable.php +++ b/Magento2/Helpers/Tokenizer/Variable.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Helpers\Tokenizer; /** diff --git a/Magento2/Sniffs/Classes/AbstractApiSniff.php b/Magento2/Sniffs/Classes/AbstractApiSniff.php index 19500772..f0614e0c 100644 --- a/Magento2/Sniffs/Classes/AbstractApiSniff.php +++ b/Magento2/Sniffs/Classes/AbstractApiSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 0f6d8bbf..6c1e9252 100644 --- a/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php +++ b/Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 852e0f7d..8661c9e3 100644 --- a/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php +++ b/Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 0144fae4..eb95b25a 100644 --- a/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php @@ -4,6 +4,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 4d76e615..11aee7ac 100644 --- a/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 0687ecf7..68147cfa 100644 --- a/Magento2/Sniffs/Exceptions/DirectThrowSniff.php +++ b/Magento2/Sniffs/Exceptions/DirectThrowSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 1149056d..91cb1f1c 100644 --- a/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php +++ b/Magento2/Sniffs/Exceptions/ThrowCatchSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Exceptions; use function array_slice; diff --git a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php index dafb3b83..c0bd036b 100644 --- a/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php +++ b/Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 20de5755..6b4d280d 100644 --- a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php +++ b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 1d6d98ec..2d41069e 100644 --- a/Magento2/Sniffs/Functions/StaticFunctionSniff.php +++ b/Magento2/Sniffs/Functions/StaticFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 cfd8d082..6c2763f6 100644 --- a/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php +++ b/Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 8f93b5e0..8f493c97 100644 --- a/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use GraphQL\Error\SyntaxError; diff --git a/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php b/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php index 074947be..ca93c122 100644 --- a/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\GraphQL; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php b/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php index 7672ae24..10cd06f3 100644 --- a/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 d9eea928..8b714fd1 100644 --- a/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 ffe8d243..39abec4c 100644 --- a/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php +++ b/Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 0032fa07..c23e6f95 100644 --- a/Magento2/Sniffs/Html/HtmlBindingSniff.php +++ b/Magento2/Sniffs/Html/HtmlBindingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Html; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php b/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php index fa093cda..87ff5702 100644 --- a/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php +++ b/Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Html; use PHP_CodeSniffer\Sniffs\Sniff; diff --git a/Magento2/Sniffs/Legacy/DiConfigSniff.php b/Magento2/Sniffs/Legacy/DiConfigSniff.php index dbb7f83c..5db95cbf 100644 --- a/Magento2/Sniffs/Legacy/DiConfigSniff.php +++ b/Magento2/Sniffs/Legacy/DiConfigSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Legacy/EmailTemplateSniff.php b/Magento2/Sniffs/Legacy/EmailTemplateSniff.php index 61295bc0..dbe6cb82 100644 --- a/Magento2/Sniffs/Legacy/EmailTemplateSniff.php +++ b/Magento2/Sniffs/Legacy/EmailTemplateSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Sniffs/Legacy/MageEntitySniff.php b/Magento2/Sniffs/Legacy/MageEntitySniff.php index 3e5c1c03..07fa5350 100644 --- a/Magento2/Sniffs/Legacy/MageEntitySniff.php +++ b/Magento2/Sniffs/Legacy/MageEntitySniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 bb6be3b3..62e9a344 100644 --- a/Magento2/Sniffs/Legacy/ModuleXMLSniff.php +++ b/Magento2/Sniffs/Legacy/ModuleXMLSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; diff --git a/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php b/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php index 3b6f276c..f37d67ac 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteAclSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 c0df2211..27a8a1bf 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php @@ -4,6 +4,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; diff --git a/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php b/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php index 8a4342f7..c65a9d5d 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 6c1280b7..d48ffde6 100644 --- a/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php +++ b/Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php @@ -4,6 +4,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; @@ -40,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 5a59433f..fe514884 100644 --- a/Magento2/Sniffs/Legacy/WidgetXMLSniff.php +++ b/Magento2/Sniffs/Legacy/WidgetXMLSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Legacy; use DOMDocument; @@ -51,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}.", diff --git a/Magento2/Sniffs/Legacy/_files/restricted_classes.php b/Magento2/Sniffs/Legacy/_files/restricted_classes.php index 84d7026c..c59935f2 100644 --- a/Magento2/Sniffs/Legacy/_files/restricted_classes.php +++ b/Magento2/Sniffs/Legacy/_files/restricted_classes.php @@ -3,6 +3,7 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 18dabfa2..89c2884f 100644 --- a/Magento2/Sniffs/Less/AvoidIdSniff.php +++ b/Magento2/Sniffs/Less/AvoidIdSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 91b2a92b..74460552 100644 --- a/Magento2/Sniffs/Less/BracesFormattingSniff.php +++ b/Magento2/Sniffs/Less/BracesFormattingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 20aa6823..60dea316 100644 --- a/Magento2/Sniffs/Less/ClassNamingSniff.php +++ b/Magento2/Sniffs/Less/ClassNamingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 d6461d7b..101da025 100644 --- a/Magento2/Sniffs/Less/ColonSpacingSniff.php +++ b/Magento2/Sniffs/Less/ColonSpacingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 c7a0eacf..e7bfa5b6 100644 --- a/Magento2/Sniffs/Less/ColourDefinitionSniff.php +++ b/Magento2/Sniffs/Less/ColourDefinitionSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 1bba8fa4..51caa5c8 100644 --- a/Magento2/Sniffs/Less/CombinatorIndentationSniff.php +++ b/Magento2/Sniffs/Less/CombinatorIndentationSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 d86f3be8..09f0c830 100644 --- a/Magento2/Sniffs/Less/CommentLevelsSniff.php +++ b/Magento2/Sniffs/Less/CommentLevelsSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 509852e6..59227366 100644 --- a/Magento2/Sniffs/Less/ImportantPropertySniff.php +++ b/Magento2/Sniffs/Less/ImportantPropertySniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 c4e52ed2..52aa8d68 100644 --- a/Magento2/Sniffs/Less/IndentationSniff.php +++ b/Magento2/Sniffs/Less/IndentationSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 e459bca7..e6e9c0e9 100644 --- a/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php +++ b/Magento2/Sniffs/Less/PropertiesLineBreakSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 03c62e29..0f1a4584 100644 --- a/Magento2/Sniffs/Less/PropertiesSortingSniff.php +++ b/Magento2/Sniffs/Less/PropertiesSortingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 30ba635a..84493010 100644 --- a/Magento2/Sniffs/Less/QuotesSniff.php +++ b/Magento2/Sniffs/Less/QuotesSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 4b8aff11..1bed997e 100644 --- a/Magento2/Sniffs/Less/SelectorDelimiterSniff.php +++ b/Magento2/Sniffs/Less/SelectorDelimiterSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 97f3800e..3473d29f 100644 --- a/Magento2/Sniffs/Less/SemicolonSpacingSniff.php +++ b/Magento2/Sniffs/Less/SemicolonSpacingSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 8f39a5da..f31011fb 100644 --- a/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php +++ b/Magento2/Sniffs/Less/TokenizerSymbolsInterface.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Less; /** diff --git a/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php b/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php index b4e52041..6406cf6a 100644 --- a/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php +++ b/Magento2/Sniffs/Less/TypeSelectorConcatenationSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 62b33dfb..1850d7b3 100644 --- a/Magento2/Sniffs/Less/TypeSelectorsSniff.php +++ b/Magento2/Sniffs/Less/TypeSelectorsSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 7e029633..d6ee556b 100644 --- a/Magento2/Sniffs/Less/VariablesSniff.php +++ b/Magento2/Sniffs/Less/VariablesSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 61183b34..0d75395d 100644 --- a/Magento2/Sniffs/Less/ZeroUnitsSniff.php +++ b/Magento2/Sniffs/Less/ZeroUnitsSniff.php @@ -3,6 +3,8 @@ * Copyright 2021 Adobe * All Rights Reserved. */ +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 2c0e3bd4..28c2f4c9 100644 --- a/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php +++ b/Magento2/Sniffs/Methods/DeprecatedModelMethodSniff.php @@ -3,6 +3,8 @@ * Copyright 2020 Adobe * All Rights Reserved. */ +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 653fb40b..3767a5b1 100644 --- a/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php +++ b/Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 2f07059a..98e08066 100644 --- a/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php +++ b/Magento2/Sniffs/NamingConvention/InterfaceNameSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 2859c15d..940faa3c 100644 --- a/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php +++ b/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 a8766d4d..6711a06c 100644 --- a/Magento2/Sniffs/PHP/FinalImplementationSniff.php +++ b/Magento2/Sniffs/PHP/FinalImplementationSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 b0e8cfd3..421c8a7e 100644 --- a/Magento2/Sniffs/PHP/GotoSniff.php +++ b/Magento2/Sniffs/PHP/GotoSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 dc142fe8..8161ad35 100644 --- a/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php +++ b/Magento2/Sniffs/PHP/LiteralNamespacesSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 66337b5b..6fc7bf7b 100644 --- a/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php +++ b/Magento2/Sniffs/PHP/ReturnValueCheckSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 4221a6cb..1cb755b4 100644 --- a/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php +++ b/Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 80b82cea..5e39f17c 100644 --- a/Magento2/Sniffs/PHP/VarSniff.php +++ b/Magento2/Sniffs/PHP/VarSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 0282fd78..34289bee 100644 --- a/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php +++ b/Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 4309457a..00f860e7 100644 --- a/Magento2/Sniffs/SQL/RawQuerySniff.php +++ b/Magento2/Sniffs/SQL/RawQuerySniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 dec0b61b..7ff5013a 100644 --- a/Magento2/Sniffs/Security/IncludeFileSniff.php +++ b/Magento2/Sniffs/Security/IncludeFileSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 8216db8e..7c4bc5e6 100644 --- a/Magento2/Sniffs/Security/InsecureFunctionSniff.php +++ b/Magento2/Sniffs/Security/InsecureFunctionSniff.php @@ -3,6 +3,8 @@ * Copyright 2019 Adobe * All Rights Reserved. */ +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 c9437b84..31fd6152 100644 --- a/Magento2/Sniffs/Security/LanguageConstructSniff.php +++ b/Magento2/Sniffs/Security/LanguageConstructSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 921b9d1c..eb698336 100644 --- a/Magento2/Sniffs/Security/SuperglobalSniff.php +++ b/Magento2/Sniffs/Security/SuperglobalSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 bd536624..7ad936b3 100644 --- a/Magento2/Sniffs/Security/XssTemplateSniff.php +++ b/Magento2/Sniffs/Security/XssTemplateSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 36616521..a82e3600 100644 --- a/Magento2/Sniffs/Strings/ExecutableRegExSniff.php +++ b/Magento2/Sniffs/Strings/ExecutableRegExSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 198a2229..35dcb3eb 100644 --- a/Magento2/Sniffs/Strings/StringConcatSniff.php +++ b/Magento2/Sniffs/Strings/StringConcatSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 2e0616d8..cc95cff9 100644 --- a/Magento2/Sniffs/Templates/ThisInTemplateSniff.php +++ b/Magento2/Sniffs/Templates/ThisInTemplateSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 d80e4e17..ab24fd23 100644 --- a/Magento2/Sniffs/Translation/ConstantUsageSniff.php +++ b/Magento2/Sniffs/Translation/ConstantUsageSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +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 79c64d67..5656d3b1 100644 --- a/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php +++ b/Magento2/Sniffs/Whitespace/MultipleEmptyLinesSniff.php @@ -3,6 +3,8 @@ * Copyright 2018 Adobe * All Rights Reserved. */ +declare(strict_types=1); + namespace Magento2\Sniffs\Whitespace; use PHP_CodeSniffer\Files\File; diff --git a/Magento2/Tests/Eslint/AbstractEslintTestCase.php b/Magento2/Tests/Eslint/AbstractEslintTestCase.php index 5e1f4fc1..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,7 +25,11 @@ abstract class AbstractEslintTestCase extends TestCase */ protected function assertFileContainsError(string $testFile, array $expectedMessages): void { - // phpcs:disable + 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, $output 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 +