Skip to content

AC-3098: Update hasDeprecatedWellFormatted #393

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

Merged
merged 1 commit into from
May 26, 2022
Merged
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
8 changes: 2 additions & 6 deletions Magento2/Helpers/Commenting/PHPDocFormattingValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,11 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
if ($deprecatedPtr === -1) {
return true;
}

$seeTagRequired = false;
if ($tokens[$deprecatedPtr + 2]['code'] !== T_DOC_COMMENT_STRING) {
$seeTagRequired = true;
}
$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
if ($seePtr === -1) {
return !$seeTagRequired;
return false;
}

return $tokens[$seePtr + 2]['code'] === T_DOC_COMMENT_STRING;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function getWarningList($testFile = '')
65 => 1,
66 => 1,
101 => 1,
109 => 1,
118 => 1,
127 => 1,
];
Expand Down
10 changes: 0 additions & 10 deletions Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ define('DS', DIRECTORY_SEPARATOR);

define('BP', dirname(__FILE__));

/**
* @deprecated It is a lie
*/
define('THERE IS', 'cake');

/**
* @deprecated New implementation available
* @see \Ascii\Asterisk
Expand All @@ -27,11 +22,6 @@ class Profiler
*/
const NUMBER_TWO = 2;

/**
* @deprecated Why not
*/
const YES = false;

/**
* @deprecated Unable to identify the question, replaced
* @see \ComputationalMatrix\Earth
Expand Down
10 changes: 10 additions & 0 deletions Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ define('NUMBER_ONE', 1);
*/
define('A', 65);

/**
* @deprecated It is a lie
*/
define('THERE IS', 'cake');

/**
* @deprecated
* @see
Expand Down Expand Up @@ -42,6 +47,11 @@ class Profiler
*/
const a = 97;

/**
* @deprecated Why not
*/
const YES = false;

/**
* @deprecated
* @see
Expand Down
12 changes: 7 additions & 5 deletions Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public function getWarningList($testFile = '')
6 => 1,
9 => 1,
14 => 1,
20 => 1,
26 => 1,
33 => 1,
19 => 1,
25 => 1,
31 => 1,
38 => 1,
43 => 1,
49 => 1,
55 => 1
48 => 1,
53 => 1,
59 => 1,
65 => 1
];
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ext-dom": "*",
"phpcompatibility/php-compatibility": "^9.3",
"squizlabs/php_codesniffer": "^3.6.1",
"rector/rector": "^0.12.17"
"rector/rector": "^0.13.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.8"
Expand Down
28 changes: 14 additions & 14 deletions composer.lock

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