File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
lib/internal/Magento/Framework/Code Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
/**
9
9
* Class ClassReader
10
- *
11
- * @package Magento\Framework\Code\Reader
12
10
*/
13
11
class ClassReader implements ClassReaderInterface
14
12
{
@@ -39,7 +37,11 @@ public function getConstructor($className)
39
37
$ parameter ->isVariadic (),
40
38
];
41
39
} catch (\ReflectionException $ e ) {
42
- $ message = $ e ->getMessage ();
40
+ $ message = sprintf (
41
+ 'Impossible to process constructor argument %s of %s class ' ,
42
+ $ parameter ->__toString (),
43
+ $ className
44
+ );
43
45
throw new \ReflectionException ($ message , 0 , $ e );
44
46
}
45
47
}
Original file line number Diff line number Diff line change @@ -60,6 +60,27 @@ public function testGetParents()
60
60
);
61
61
}
62
62
63
+ /**
64
+ * Check that while processing nonexistent argument of constructor exception message contains original class name
65
+ */
66
+ public function testGetConstructorWithNonexistentDependency ()
67
+ {
68
+ $ testClass = new class {
69
+ private $ arg ;
70
+
71
+ // phpstan:ignore
72
+ public function __construct (?\NonexistentDependency $ arg = null )
73
+ {
74
+ $ this ->arg = $ arg ;
75
+ }
76
+ };
77
+
78
+ $ className = get_class ($ testClass );
79
+ $ this ->expectException (\ReflectionException::class);
80
+ $ this ->expectExceptionMessage ($ className );
81
+ $ this ->model ->getConstructor ($ className );
82
+ }
83
+
63
84
/**
64
85
* Data provider
65
86
*
You can’t perform that action at this time.
0 commit comments