Skip to content

Commit b9441a4

Browse files
committed
[+]: "PhpCodeParser" -> fix cache key v2
1 parent 744a779 commit b9441a4

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### master
4+
5+
- "PhpCodeParser" -> fix cache key
6+
37
### 0.11.0 (2020-06-18)
48

59
- "PHPInterface" -> fix recursion

src/voku/SimplePhpParser/Parsers/PhpCodeParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function process(
169169
string $cacheKey,
170170
array $autoloaderProjectPaths
171171
) {
172-
$cacheKey .= '--process';
172+
$cacheKey .= '--process--' . md5(\implode('|', $autoloaderProjectPaths));
173173

174174
foreach ($autoloaderProjectPaths as $projectPath) {
175175
if (\file_exists($projectPath . '/vendor/autoload.php')) {

src/voku/SimplePhpParser/Parsers/Visitors/ASTVisitor.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public function enterNode(Node $node)
5959

6060
case $node instanceof Const_:
6161

62-
$constant = (new PHPConst($this->parserContainer))->readObjectFromPhpNode($node);
62+
$constant = new PHPConst($this->parserContainer);
63+
$constant = $constant->readObjectFromPhpNode($node);
6364
if (!$constant->file) {
6465
$constant->file = $this->fileName;
6566
}
@@ -83,7 +84,8 @@ public function enterNode(Node $node)
8384
&&
8485
$node->name->parts[0] === 'define'
8586
) {
86-
$constant = (new PHPDefineConstant($this->parserContainer))->readObjectFromPhpNode($node);
87+
$constant = new PHPDefineConstant($this->parserContainer);
88+
$constant = $constant->readObjectFromPhpNode($node);
8789
if (!$constant->file) {
8890
$constant->file = $this->fileName;
8991
}
@@ -104,7 +106,8 @@ public function enterNode(Node $node)
104106

105107
case $node instanceof Class_:
106108

107-
$class = (new PHPClass($this->parserContainer))->readObjectFromPhpNode($node);
109+
$class = new PHPClass($this->parserContainer);
110+
$class = $class->readObjectFromPhpNode($node);
108111
if (!$class->file) {
109112
$class->file = $this->fileName;
110113
}

0 commit comments

Comments
 (0)