Skip to content

Commit

Permalink
Merge pull request #234 from magento-gl/gl_pr_arrows_codingstandard_j…
Browse files Browse the repository at this point in the history
…ul28_2023

Arrows Team - Bugfix delivery
  • Loading branch information
slavvka authored Sep 6, 2023
2 parents 99e3ae2 + a7257ac commit db2e2e7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CopyrightAnotherExtensionsFilesSniff implements Sniff

private const COPYRIGHT_MAGENTO_TEXT = 'Copyright © Magento, Inc. All rights reserved.';
private const COPYRIGHT_ADOBE = '/Copyright \d+ Adobe/';
private const COPYRIGHT_ADOBE_TEXT = 'ADOBE CONFIDENTIAL';

/**
* Defines the tokenizers that this sniff is using.
Expand Down Expand Up @@ -48,6 +49,7 @@ public function process(File $phpcsFile, $stackPtr)

if (strpos($fileText, self::COPYRIGHT_MAGENTO_TEXT) !== false
|| preg_match(self::COPYRIGHT_ADOBE, $fileText)
|| strpos($fileText, self::COPYRIGHT_ADOBE_TEXT) !== false
) {
return;
}
Expand Down
5 changes: 4 additions & 1 deletion Magento2Framework/Sniffs/Header/CopyrightGraphQLSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CopyrightGraphQLSniff implements Sniff

private const COPYRIGHT_MAGENTO_TEXT = 'Copyright © Magento, Inc. All rights reserved.';
private const COPYRIGHT_ADOBE = '/Copyright \d+ Adobe/';
private const COPYRIGHT_ADOBE_TEXT = 'ADOBE CONFIDENTIAL';

private const FILE_EXTENSION = 'graphqls';

Expand Down Expand Up @@ -44,7 +45,9 @@ public function process(File $phpcsFile, $stackPtr)
// @phpcs:ignore Magento2.Functions.DiscouragedFunction.Discouraged
$content = file_get_contents($phpcsFile->getFilename());

if (strpos($content, self::COPYRIGHT_MAGENTO_TEXT) !== false || preg_match(self::COPYRIGHT_ADOBE, $content)) {
if (strpos($content, self::COPYRIGHT_MAGENTO_TEXT) !== false
|| preg_match(self::COPYRIGHT_ADOBE, $content)
|| strpos($content, self::COPYRIGHT_ADOBE_TEXT) !== false) {
return;
}

Expand Down
5 changes: 4 additions & 1 deletion Magento2Framework/Sniffs/Header/CopyrightSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CopyrightSniff implements Sniff

private const COPYRIGHT_MAGENTO_TEXT = 'Copyright © Magento, Inc. All rights reserved.';
private const COPYRIGHT_ADOBE = '/Copyright \d+ Adobe/';
private const COPYRIGHT_ADOBE_TEXT = 'ADOBE CONFIDENTIAL';

/**
* @inheritdoc
Expand Down Expand Up @@ -48,7 +49,9 @@ public function process(File $phpcsFile, $stackPtr)
$content = $phpcsFile->getTokens()[$positionComment]['content'];
$adobeCopyrightFound = preg_match(self::COPYRIGHT_ADOBE, $content);

if (strpos($content, self::COPYRIGHT_MAGENTO_TEXT) !== false || $adobeCopyrightFound) {
if (strpos($content, self::COPYRIGHT_MAGENTO_TEXT) !== false ||
$adobeCopyrightFound ||
strpos($content, self::COPYRIGHT_ADOBE_TEXT) !== false) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"AFL-3.0"
],
"type": "phpcodesniffer-standard",
"version": "31",
"version": "32",
"require": {
"php": "~8.1.0 || ~8.2.0",
"webonyx/graphql-php": "^15.0",
"ext-simplexml": "*",
"ext-dom": "*",
"phpcompatibility/php-compatibility": "^9.3",
"squizlabs/php_codesniffer": "^3.6.1",
"rector/rector": "^0.15.10",
"rector/rector": "0.17.12",
"symfony/polyfill": "^1.16",
"phpcsstandards/phpcsutils": "^1.0.5"
},
Expand Down
43 changes: 23 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit db2e2e7

Please sign in to comment.