clemens-tolboom / uml-generator-php

http://clemens-tolboom.github.io/uml-generator-php/
MIT License
44 stars 5 forks source link

PHP 7 Usage #70

Closed djjohnjosephuk closed 8 years ago

djjohnjosephuk commented 8 years ago

I couldn't find anything in the comments that mentioned which PHP versions this supports, and after install it failed on my PHP 7 install. Fixing it to work for PHP 7 was as simple as fixing one line and updating the nikic/PHP-Parser library to 2.* in the composer.json.

JsonCommand.php Line 96:

    // removed, php parser uses factory for creation 
    // $parser = new \PhpParser\Parser(new \PhpParser\Lexer);
    $parser = (new \PhpParser\ParserFactory)->create(\PhpParser\ParserFactory::PREFER_PHP7, new \PhpParser\Lexer);

The php parser will use PHP 7 and backfill to PHP 5 according to their docs, though I've not tested the lines above would still work for PHP 5.

For info, the error returned was the use of String as a class name in the php parser library (version 1.x)

clemens-tolboom commented 8 years ago

There is PR #69 by @GawainLynch

clemens-tolboom commented 8 years ago

I merged #69 so close this. @djjohnjosephuk please test latest release :)