The expression $result of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an
empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using empty(..) or !empty(...) instead.
Loading history...
43
throw new Exception('Can\'t parse INI front matter');
44
}
45
46
return $result;
47
1
case 'yaml':
48
default:
49
try {
50
1
$result = Yaml::parse((string) $string);
51
1
if (!is_array($result)) {
52
1
throw new Exception('Parse result of YAML front matter is not an array');
53
}
54
55
1
return $result;
56
1
} catch (ParseException $e) {
57
1
throw new Exception($e->getMessage());
58
}
59
}
60
}
61
62
/**
63
* {@inheritdoc}
64
*/
65
1
public function convertBody(string $string): string
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.