When dealing with truncated or otherwise incomplete php files, sometimes the file ends inside a block.
function incomplete() {
return something();
for some block types - class, switch - it comes out fine, just a syntax error and dropping the entry. For the majority though, - do, foreach, function, if, namespace, while - the parser returns nil and php-parser crashes.
I haven't yet seen an unclosed parenthetical break the parser, but that seems like a possibility too.
When dealing with truncated or otherwise incomplete php files, sometimes the file ends inside a block.
for some block types -
class,switch- it comes out fine, just a syntax error and dropping the entry. For the majority though, -do,foreach,function,if,namespace,while- the parser returnsnilandphp-parsercrashes.I haven't yet seen an unclosed parenthetical break the parser, but that seems like a possibility too.