Skip to content

Commit f00dbbd

Browse files
authored
compatibility for 4.x and lower
1 parent 0d570d3 commit f00dbbd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ModelFinder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ public function getModelsInDirectory(string $directory): Collection
5454

5555
protected function getFullyQualifiedClassNameFromFile(string $path): string
5656
{
57-
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
57+
$factory = new ParserFactory();
58+
$parser = method_exists($factory, 'createForHostVersion')
59+
? $factory->createForHostVersion()
60+
: $factory->create(ParserFactory::PREFER_PHP7);
5861

5962
$traverser = new NodeTraverser();
6063
$traverser->addVisitor(new NameResolver());

0 commit comments

Comments
 (0)