| Conditions | 6 |
| Paths | 5 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function canSolve(Throwable $throwable): bool |
||
| 15 | { |
||
| 16 | if (! ($throwable instanceof FatalThrowableError || $throwable instanceof ParseError)) { |
||
| 17 | return false; |
||
| 18 | } |
||
| 19 | |||
| 20 | if (! Str::startsWith($throwable->getMessage(), 'syntax error, unexpected \'<<\'')) { |
||
|
|
|||
| 21 | return false; |
||
| 22 | } |
||
| 23 | |||
| 24 | $file = file_get_contents($throwable->getFile()); |
||
| 25 | |||
| 26 | if (strpos($file, '=======') === false) { |
||
| 27 | return false; |
||
| 28 | } |
||
| 29 | |||
| 30 | if (strpos($file, '>>>>>>>') === false) { |
||
| 31 | return false; |
||
| 32 | } |
||
| 33 | |||
| 34 | return true; |
||
| 35 | } |
||
| 36 | |||
| 62 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: