Skip to content

fix a PHP version #48

@DylannCordel

Description

@DylannCordel

Hi,

I saw here a discussion start about PHP version.
Currently, It seems that phply is a mix between php 5.x and php 7.x.

For exemple this code is parsed like PHP 5.6.x:

yield $foo or die;

Its returns Yield(BinaryOp(u'or', Variable(u'$foo'), Exit(None, u'die')))
instead of BinaryOp(u'or', Yield(Variable(u'$foo')), Exit(None, u'die'))

see yield is now a right associative operator

  1. Maybe phply could have a param to specify which version of PHP we want to parse ?
  2. Or maybe you could have a branch for each "X.Y" version of PHP ?

What do you think about it ? IMHO, solution 1 will be more useful: for ex, a script could try to parse a file with a specific version and fallback with another if there is a SyntaxError Exception raised by phply.

Once there will be a fixed php version for a context, we could fix this type of errors.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions