diff --git a/src/Parser/PhpParser.php b/src/Parser/PhpParser.php index 2575d1d..3bd1cb1 100644 --- a/src/Parser/PhpParser.php +++ b/src/Parser/PhpParser.php @@ -26,7 +26,7 @@ class PhpParser implements PhpParserInterface */ public function __construct(ParserFactory $parserFactory) { - $this->parser = $parserFactory->createForNewestSupportedVersion(); + $this->parser = method_exists($parserFactory, 'createForNewestSupportedVersion') ? $parserFactory->createForNewestSupportedVersion() : $parserFactory->create(ParserFactory::PREFER_PHP7); } /**