Skip to content

Commit

Permalink
Enable strict type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Sep 27, 2024
1 parent 02b640a commit 5e2f01d
Show file tree
Hide file tree
Showing 73 changed files with 137 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Magento2/Helpers/Commenting/PHPDocFormattingValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Helpers/Tokenizer/AbstractTokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Helpers\Tokenizer;

/**
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Helpers/Tokenizer/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Helpers\Tokenizer;

/**
Expand Down
1 change: 1 addition & 0 deletions Magento2/Helpers/Tokenizer/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Helpers\Tokenizer;

Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Classes/AbstractApiSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Classes/DiscouragedDependenciesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/CodeAnalysis/EmptyBlockSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Commenting/ConstantsPHPDocFormattingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Exceptions/DirectThrowSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Exceptions/ThrowCatchSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Exceptions;

Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Exceptions/TryProcessSystemResourcesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Functions/StaticFunctionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/AbstractGraphQLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/ValidFieldNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/ValidTopLevelFieldNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/ValidTypeNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Html/HtmlBindingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Html;

Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Html;

Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/DiConfigSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/EmailTemplateSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/MageEntitySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/ModuleXMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/ObsoleteAclSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down
4 changes: 3 additions & 1 deletion Magento2/Sniffs/Legacy/ObsoleteMenuSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,7 +17,7 @@
class ObsoleteMenuSniff implements Sniff
{
private const WARNING_OBSOLETE_MENU_STRUCTURE = 'ObsoleteMenuStructure';

/**
* @var string
*/
Expand Down
7 changes: 4 additions & 3 deletions Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/WidgetXMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

Expand Down
1 change: 1 addition & 0 deletions Magento2/Sniffs/Legacy/_files/restricted_classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/AvoidIdSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/BracesFormattingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/ClassNamingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/ColonSpacingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/ColourDefinitionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/CombinatorIndentationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/CommentLevelsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/ImportantPropertySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/IndentationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/PropertiesLineBreakSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Less/PropertiesSortingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 5e2f01d

Please sign in to comment.