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 77
88/**
99 * Class ClassReader
10- *
11- * @package Magento\Framework\Code\Reader
1210 */
1311class ClassReader implements ClassReaderInterface
1412{
@@ -39,7 +37,11 @@ public function getConstructor($className)
3937 $ parameter ->isVariadic (),
4038 ];
4139 } 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+ );
4345 throw new \ReflectionException ($ message , 0 , $ e );
4446 }
4547 }
Original file line number Diff line number Diff line change @@ -60,6 +60,27 @@ public function testGetParents()
6060 );
6161 }
6262
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+
6384 /**
6485 * Data provider
6586 *
You can’t perform that action at this time.
0 commit comments