| Conditions | 3 |
| Paths | 4 |
| Total Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | protected function jsonable(): string |
||
| 50 | { |
||
| 51 | $driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME); |
||
| 52 | $dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION); |
||
| 53 | $isOldVersion = version_compare($dbVersion, '5.7.8', 'lt'); |
||
| 54 | |||
| 55 | return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json'; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
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: