Skip to content

Commit 8c60047

Browse files
committed
AC-660: Create phpcs static check for DiConfigTest
- Refactor: Rename variables and add phpdoc
1 parent 6031c1e commit 8c60047

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Magento2/Sniffs/Legacy/DiConfigSniff.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class DiConfigSniff implements Sniff
1313
{
1414
private const WARNING_CODE = 'FoundObsoleteAttribute';
1515

16-
private $xpathObsoleteElems = [
16+
/**
17+
* @var string[] Associative array containing the obsolete nodes and the message to display when they are found.
18+
*/
19+
private $obsoleteDiNodes = [
1720
'<param' => 'The <param> node is obsolete. Instead, use the <argument name="..." xsi:type="...">',
1821
'<instance' => 'The <instance> node is obsolete. Instead, use the <argument name="..." xsi:type="object">',
1922
'<array' => 'The <array> node is obsolete. Instead, use the <argument name="..." xsi:type="array">',
@@ -38,8 +41,8 @@ public function process(File $phpcsFile, $stackPtr)
3841
{
3942
$lineContent = $phpcsFile->getTokensAsString($stackPtr, 1);
4043

41-
foreach ($this->xpathObsoleteElems as $elem => $message) {
42-
if (strpos($lineContent, $elem) !== false) {
44+
foreach ($this->obsoleteDiNodes as $element => $message) {
45+
if (strpos($lineContent, $element) !== false) {
4346
$phpcsFile->addWarning(
4447
$message,
4548
$stackPtr,

0 commit comments

Comments
 (0)