File tree 2 files changed +8
-4
lines changed
src/Magento/FunctionalTestingFramework
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class ClassReader implements ClassReaderInterface
13
13
* @param string $className
14
14
* @return array|null
15
15
* @throws \ReflectionException
16
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
16
17
*/
17
18
public function getConstructor ($ className )
18
19
{
@@ -24,8 +25,9 @@ public function getConstructor($className)
24
25
/** @var $parameter \ReflectionParameter */
25
26
foreach ($ constructor ->getParameters () as $ parameter ) {
26
27
try {
27
- $ name = $ parameter ->getType () && !$ parameter ->getType ()->isBuiltin ()
28
- ? new \ReflectionClass ($ parameter ->getType ()->getName ())
28
+ $ paramType = $ parameter ->getType ();
29
+ $ name = ($ paramType && method_exists ($ paramType , 'isBuiltin ' ) && !$ paramType ->isBuiltin ())
30
+ ? new \ReflectionClass ($ paramType ->getName ())
29
31
: null ;
30
32
$ result [] = [
31
33
$ parameter ->getName (),
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class ClassReader
20
20
* @param string $method
21
21
* @return array|null
22
22
* @throws \ReflectionException
23
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
23
24
*/
24
25
public function getParameters ($ className , $ method )
25
26
{
@@ -31,8 +32,9 @@ public function getParameters($className, $method)
31
32
/** @var $parameter \ReflectionParameter */
32
33
foreach ($ method ->getParameters () as $ parameter ) {
33
34
try {
34
- $ name = $ parameter ->getType () && !$ parameter ->getType ()->isBuiltin ()
35
- ? new \ReflectionClass ($ parameter ->getType ()->getName ())
35
+ $ paramType = $ parameter ->getType ();
36
+ $ name = ($ paramType && method_exists ($ paramType , 'isBuiltin ' ) && !$ paramType ->isBuiltin ())
37
+ ? new \ReflectionClass ($ paramType ->getName ())
36
38
: null ;
37
39
$ result [$ parameter ->getName ()] = [
38
40
$ parameter ->getName (),
You can’t perform that action at this time.
0 commit comments