| Conditions | 1 |
| Paths | 1 |
| Total Lines | 8 |
| Code Lines | 2 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 24 | public function guard(callable $callback): callable |
||
| 25 | { |
||
| 26 | //NOTE: Use at your own risk! As it does not re-throw exception back to V8, js exection continues, but as PHP |
||
| 27 | // stays in unclean state it callbacks won't be run and thus js will get undefined value instead of |
||
| 28 | // expected result, which will yield js-originated exceptions, which in turn will result in PHP exception |
||
| 29 | // which will replace original PHP exception that caused problem and set it as Exception::$previous. |
||
| 30 | return $callback; |
||
| 31 | } |
||
| 32 | } |
||
| 33 |