File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
lib/internal/Magento/Framework/Autoload Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Framework \Autoload ;
7
7
8
+ use InvalidArgumentException ;
8
9
use Magento \Framework \Autoload \AutoloaderInterface ;
9
10
10
11
/**
@@ -23,23 +24,23 @@ class AutoloaderRegistry
23
24
* @param AutoloaderInterface $newAutoloader
24
25
* @return void
25
26
*/
26
- public static function registerAutoloader (AutoloaderInterface $ newAutoloader )
27
+ public static function registerAutoloader (AutoloaderInterface $ newAutoloader ): void
27
28
{
28
29
self ::$ autoloader = $ newAutoloader ;
29
30
}
30
31
31
32
/**
32
33
* Returns the registered autoloader
33
34
*
34
- * @throws \Exception
35
+ * @throws InvalidArgumentException
35
36
* @return AutoloaderInterface
36
37
*/
37
- public static function getAutoloader ()
38
+ public static function getAutoloader (): AutoloaderInterface
38
39
{
39
- if (self ::$ autoloader !== null ) {
40
- return self ::$ autoloader ;
41
- } else {
42
- throw new \Exception ('Autoloader is not registered, cannot be retrieved. ' );
40
+ if (!self ::$ autoloader instanceof AutoloaderInterface) {
41
+ throw new InvalidArgumentException ('Autoloader is not registered, cannot be retrieved. ' );
43
42
}
43
+
44
+ return self ::$ autoloader ;
44
45
}
45
46
}
You can’t perform that action at this time.
0 commit comments