Skip to content

Commit aeb9cf7

Browse files
committed
f
1 parent b88cdb8 commit aeb9cf7

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/HeroAutoload.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ErrorHeroModule;
6+
7+
use RuntimeException;
8+
9+
class HeroAutoload
10+
{
11+
public static function handle(string $class)
12+
{
13+
if (\class_exists($class)) {
14+
return;
15+
}
16+
17+
throw new RuntimeException(sprintf(
18+
'class %s not found',
19+
$class
20+
));
21+
}
22+
}

src/Listener/Mvc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Assert\Assertion;
88
use ErrorHeroModule\Handler\Logging;
9+
use ErrorHeroModule\HeroAutoload;
910
use ErrorHeroModule\HeroTrait;
1011
use Zend\Console\Response as ConsoleResponse;
1112
use Zend\EventManager\AbstractListenerAggregate;
@@ -56,6 +57,7 @@ public function phpError(MvcEvent $e) : void
5657
{
5758
\register_shutdown_function([$this, 'execOnShutdown']);
5859
\set_error_handler([$this, 'phpErrorHandler']);
60+
//\spl_autoload_register([HeroAutoload::class, 'handle']);
5961
}
6062

6163
public function exceptionError(MvcEvent $e) : void

src/Middleware/Expressive.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Closure;
88
use Error;
99
use ErrorHeroModule\Handler\Logging;
10+
use ErrorHeroModule\HeroAutoload;
1011
use ErrorHeroModule\HeroTrait;
1112
use Exception;
1213
use Psr\Http\Message\ResponseInterface;
@@ -60,6 +61,7 @@ public function phpError() : void
6061
{
6162
\register_shutdown_function([$this, 'execOnShutdown']);
6263
\set_error_handler([$this, 'phpErrorHandler']);
64+
//\spl_autoload_register([HeroAutoload::class, 'handle']);
6365
}
6466

6567
/**

0 commit comments

Comments
 (0)