| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function parse() { |
||
| 39 | // Sanitize PyString test by removing initial indentation spaces. |
||
| 40 | $strings = $this->node->getStrings(); |
||
| 41 | if ($strings) { |
||
|
|
|||
| 42 | preg_match('/^(\s+)/', $strings[0], $matches); |
||
| 43 | $indentation_size = isset($matches[1]) ? strlen($matches[1]) : 0; |
||
| 44 | foreach ($strings as $key => $string) { |
||
| 45 | $strings[$key] = substr($string, $indentation_size); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | $raw = implode("\n", $strings); |
||
| 49 | return Yaml::parse($raw); |
||
| 50 | } |
||
| 51 | |||
| 53 |
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.