PHP variables are dynamic in type so I can do:
$x = 'hello world!'; $x = strlen($x);
Sometimes this is trivial and I could save many lines of code, but it reduces clarity. I'm using a text editor, but I guess IDEs (and programmers) could be confused if a variable change type.
Less trivial case:
if (is_string($data)) $lines = explode(PHP_EOL,$data); else $lines = $data;
if (is_string($data)) $data = explode(PHP_EOL,$data);
Of course I could do something like:
$lines = is_string($data) ? explode(PHP_EOL,$data) : $data;
But that's not the point.
BTW: I'm assuming $data is string or array and this should be documented as such.