| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function parse(PyStringNode $node) { |
||
| 25 | // Sanitize PyString test by removing initial indentation spaces. |
||
| 26 | $strings = $node->getStrings(); |
||
| 27 | if ($strings) { |
||
|
|
|||
| 28 | preg_match('/^(\s+)/', $strings[0], $matches); |
||
| 29 | $indentation_size = isset($matches[1]) ? strlen($matches[1]) : 0; |
||
| 30 | foreach ($strings as $key => $string) { |
||
| 31 | $strings[$key] = substr($string, $indentation_size); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | $raw = implode("\n", $strings); |
||
| 35 | return Yaml::parse($raw); |
||
| 36 | } |
||
| 37 | |||
| 39 |
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.