Skip to content

Commit cf710b9

Browse files
committed
compatibility with php-parser 5
1 parent aa70ef9 commit cf710b9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bin/dredd-hooks-laravel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $options = getopt('', [
4949

5050
// Second argument is the single kernel file
5151
$dreddKernelPath = $argv[1];
52-
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
52+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
5353

5454
try {
5555
$statements = $parser->parse(file_get_contents($dreddKernelPath));
@@ -60,7 +60,7 @@ try {
6060

6161
try {
6262
if ($statements[0] instanceof PhpParser\Node\Stmt\Namespace_) {
63-
$kernelClass = implode('\\', $statements[0]->name->parts);
63+
$kernelClass = implode('\\', $statements[0]->name->getParts());
6464
foreach ($statements[0]->stmts as $statement) {
6565
if ($statement instanceof PhpParser\Node\Stmt\Class_) {
6666
$kernelClass .= '\\' . $statement->name;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "package",
55
"require": {
66
"php": ">=7.2",
7-
"nikic/php-parser": "^4.2",
7+
"nikic/php-parser": "^5.0",
88
"ddelnano/dredd-hooks-php": "^2.0"
99
},
1010
"license": "MIT",

0 commit comments

Comments
 (0)