Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require a strict_types declaration #488

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 2019 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Helpers\Tokenizer;

/**
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Helpers/Tokenizer/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2018 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2018 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Exceptions;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Exceptions/ThrowCatchSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2019 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Exceptions;

use function array_slice;
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 2019 Adobe
* All Rights Reserved.
*/
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 2018 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/ValidArgumentNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2019 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

use GraphQL\Error\SyntaxError;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/GraphQL/ValidEnumValueSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2019 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

use PHP_CodeSniffer\Files\File;
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 2019 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
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 2019 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\GraphQL;

use PHP_CodeSniffer\Files\File;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Html/HtmlBindingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Html;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Html/HtmlCollapsibleAttributeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Html;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/DiConfigSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use PHP_CodeSniffer\Files\File;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/EmailTemplateSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use PHP_CodeSniffer\Files\File;
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 2018 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/ModuleXMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use DOMDocument;
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 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use DOMDocument;
Expand Down
2 changes: 2 additions & 0 deletions Magento2/Sniffs/Legacy/ObsoleteConfigNodesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use DOMDocument;
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 2021 Adobe
* All Rights Reserved.
*/
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
8 changes: 5 additions & 3 deletions Magento2/Sniffs/Legacy/ObsoleteSystemConfigurationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use DOMDocument;
Expand Down Expand Up @@ -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.",
Expand Down
4 changes: 3 additions & 1 deletion Magento2/Sniffs/Legacy/WidgetXMLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Legacy;

use DOMDocument;
Expand Down Expand Up @@ -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}.",
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
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 2021 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

namespace Magento2\Sniffs\Less;

use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
Loading
Loading