Skip to content

Commit c95285d

Browse files
authored
Merge pull request #38 from msievenpiper/nikic/php-parser-5
Update nikic/php-parser from ^4 to ^5
2 parents 91d318e + 015090f commit c95285d

6 files changed

+8
-7
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest]
16-
php: [8.2, 8.1, 8.0, 7.4, 7.3]
16+
php: [8.2, 8.1, 8.0, 7.4]
1717

1818
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
1919

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
}
2020
],
2121
"require": {
22-
"php": "^7.3|^8.0",
23-
"nikic/php-parser": "^4.10",
22+
"php": "^7.4|^8.0",
23+
"nikic/php-parser": "^5.0",
2424
"permafrost-dev/code-snippets": "^1.2.0"
2525
},
2626
"require-dev": {

src/Searcher.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use PhpParser\NodeFinder;
2424
use PhpParser\NodeTraverser;
2525
use PhpParser\ParserFactory;
26+
use PhpParser\PhpVersion;
2627

2728
class Searcher
2829
{
@@ -55,7 +56,7 @@ class Searcher
5556

5657
public function __construct($parser = null)
5758
{
58-
$this->parser = $parser ?? (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
59+
$this->parser = $parser ?? (new ParserFactory())->createForHostVersion();
5960
}
6061

6162
public function assignments(array $varNames): self

src/Support/VirtualFile.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __destruct()
1818

1919
public function unlink()
2020
{
21-
if (dirname($this->path) !== sys_get_temp_dir()) {
21+
if (!strpos(dirname($this->path), sys_get_temp_dir())) {
2222
return;
2323
}
2424

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-
22
location: { column: 0, endLine: 4, startLine: 3 }
3-
node: { variableName: { subNodeNames: [name], specialClassName: false, type: Identifier, line: 3, startLine: 3, endLine: 3, startTokenPos: -1, endTokenPos: -1, startFilePos: -1, endFilePos: -1, comments: { }, docComment: null, attributes: { startLine: 3, endLine: 3 }, name: whereSessionRegistrationUuid }, methodName: firstOrFail, name: $whereSessionRegistrationUuid->firstOrFail, args: { }, location: { column: 0, endLine: 4, startLine: 3 } }
3+
node: { variableName: { subNodeNames: [name], specialClassName: false, type: Identifier, line: 3, startLine: 3, endLine: 3, startTokenPos: 13, endTokenPos: 13, startFilePos: 82, endFilePos: 109, comments: { }, docComment: null, attributes: { startLine: 3, startTokenPos: 13, startFilePos: 82, endLine: 3, endTokenPos: 13, endFilePos: 109 }, name: whereSessionRegistrationUuid }, methodName: firstOrFail, name: $whereSessionRegistrationUuid->firstOrFail, args: { }, location: { column: 0, endLine: 4, startLine: 3 } }
44
snippet: null
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-
22
location: { column: 0, endLine: 13, startLine: 13 }
3-
node: { variableName: obj, value: { subNodeNames: [class, args], type: Expr_New, rawArgs: { }, firstClassCallable: false, args: { }, line: 13, startLine: 13, endLine: 13, startTokenPos: -1, endTokenPos: -1, startFilePos: -1, endFilePos: -1, comments: { }, docComment: null, attributes: { startLine: 13, endLine: 13 }, class: { subNodeNames: [parts], parts: [MyClass], first: MyClass, last: MyClass, unqualified: true, qualified: false, fullyQualified: false, relative: false, specialClassName: false, type: Name, line: 13, startLine: 13, endLine: 13, startTokenPos: -1, endTokenPos: -1, startFilePos: -1, endFilePos: -1, comments: { }, docComment: null, attributes: { startLine: 13, endLine: 13 } } }, name: obj, location: { column: 0, endLine: 13, startLine: 13 } }
3+
node: { variableName: obj, value: { subNodeNames: [class, args], type: Expr_New, rawArgs: { }, firstClassCallable: false, args: { }, line: 13, startLine: 13, endLine: 13, startTokenPos: 57, endTokenPos: 61, startFilePos: 157, endFilePos: 169, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 57, startFilePos: 157, endLine: 13, endTokenPos: 61, endFilePos: 169 }, class: { subNodeNames: [name], parts: [MyClass], first: MyClass, last: MyClass, unqualified: true, qualified: false, fullyQualified: false, relative: false, specialClassName: false, type: Name, line: 13, startLine: 13, endLine: 13, startTokenPos: 59, endTokenPos: 59, startFilePos: 161, endFilePos: 167, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 59, startFilePos: 161, endLine: 13, endTokenPos: 59, endFilePos: 167 }, name: MyClass } }, name: obj, location: { column: 0, endLine: 13, startLine: 13 } }
44
snippet: null

0 commit comments

Comments
 (0)