File tree Expand file tree Collapse file tree 6 files changed +64
-1
lines changed
Expand file tree Collapse file tree 6 files changed +64
-1
lines changed Original file line number Diff line number Diff line change 55/.travis.yml export-ignore
66/phpstan.neon export-ignore
77/spec / export-ignore
8- /CONTRIBUTING.md export-ignore
8+ /CONTRIBUTING.md export-ignore
9+ /kahlan-config.php export-ignore
Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ coverage.json
55bin
66.php_cs.cache
77.vscode /
8+ build /logs /*
Original file line number Diff line number Diff line change 1+ <?php // kahlan-config.php
2+
3+ use Kahlan \Filter \Filters ;
4+ use Kahlan \Reporter \Coverage ;
5+ use Kahlan \Reporter \Coverage \Driver \Xdebug ;
6+
7+ Filters::apply ($ this , 'coverage ' , function ($ next ) {
8+ if (! extension_loaded ('xdebug ' )) {
9+ return ;
10+ }
11+
12+ $ reporters = $ this ->reporters ();
13+ $ coverage = new Coverage ([
14+ 'verbosity ' => $ this ->commandLine ()->get ('coverage ' ),
15+ 'driver ' => new Xdebug (),
16+ 'path ' => $ this ->commandLine ()->get ('src ' ),
17+ 'exclude ' => [
18+ 'src/HeroAutoload.php ' ,
19+ ],
20+ 'colors ' => ! $ this ->commandLine ()->get ('no-colors ' )
21+ ]);
22+ $ reporters ->add ('coverage ' , $ coverage );
23+ });
Original file line number Diff line number Diff line change 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+ if (\in_array (
18+ $ class ,
19+ [
20+ 'error_reporting ' ,
21+ 'error_get_last ' ,
22+ 'ErrorHeroModuleLogger ' ,
23+ 'ZendDeveloperTools \\ProfilerEvent ' ,
24+ ]
25+ )) {
26+ return ;
27+ }
28+
29+ throw new RuntimeException (sprintf (
30+ 'class %s not found ' ,
31+ $ class
32+ ));
33+ }
34+ }
Original file line number Diff line number Diff line change 66
77use Assert \Assertion ;
88use ErrorHeroModule \Handler \Logging ;
9+ use ErrorHeroModule \HeroAutoload ;
910use ErrorHeroModule \HeroTrait ;
1011use Zend \Console \Response as ConsoleResponse ;
1112use 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
Original file line number Diff line number Diff line change 77use Closure ;
88use Error ;
99use ErrorHeroModule \Handler \Logging ;
10+ use ErrorHeroModule \HeroAutoload ;
1011use ErrorHeroModule \HeroTrait ;
1112use Exception ;
1213use 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 /**
You can’t perform that action at this time.
0 commit comments