Skip to content

Commit 47aff65

Browse files
committed
AC-6840:Remove from Constructor Integrity validator check for excess arguments, passed in the parent constructor
1 parent a2c6b29 commit 47aff65

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

lib/internal/Magento/Framework/Code/Test/Unit/Validator/ConstructorIntegrityTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ public function testValidateIfClassHasArgumentsQtyEqualToParentClass()
5252

5353
public function testValidateIfClassHasExtraArgumentInTheParentConstructor()
5454
{
55-
$fileName = realpath(__DIR__ . '/../_files/app/code/Magento/SomeModule/Model/Four/Test.php');
56-
$fileName = str_replace('\\', '/', $fileName);
57-
$this->expectException(ValidatorException::class);
58-
$this->expectExceptionMessage('Extra parameters passed to parent construct: $factory. File: ' . $fileName);
5955
$this->_model->validate(\Magento\SomeModule\Model\Four\Test::class);
6056
}
6157

lib/internal/Magento/Framework/Code/Validator/ConstructorIntegrity.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,6 @@ public function validate($className)
8989
}
9090
}
9191

92-
/**
93-
* Try to detect unused arguments
94-
* Check whether count of passed parameters less or equal that count of count parent class arguments
95-
*/
96-
if (count($callArguments) > count($parentArguments)) {
97-
$extraParameters = array_slice($callArguments, count($parentArguments));
98-
$names = [];
99-
foreach ($extraParameters as $param) {
100-
$names[] = '$' . $param['name'];
101-
}
102-
103-
$classPath = str_replace('\\', '/', $class->getFileName());
104-
throw new \Magento\Framework\Exception\ValidatorException(
105-
new Phrase(
106-
'Extra parameters passed to parent construct: %1. File: %2',
107-
[implode(', ', $names), $classPath]
108-
)
109-
);
110-
}
11192
return true;
11293
}
11394

@@ -142,7 +123,7 @@ private function checkCompatibleTypes(
142123
}
143124

144125
/**
145-
* Check if argument argument is optional
126+
* Check if required argument is optional
146127
*
147128
* @param array $requiredArgument
148129
* @param \ReflectionClass $class

0 commit comments

Comments
 (0)