Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3c5ff39

Browse filesBrowse files
committed
add ObjectValue to exceptions
1 parent e5922fc commit 3c5ff39
Copy full SHA for 3c5ff39

File tree

1 file changed

+6
-5
lines changed
Filter options

1 file changed

+6
-5
lines changed

‎app/Parsers/ArrayCreationExpressionParser.php

Copy file name to clipboardExpand all lines: app/Parsers/ArrayCreationExpressionParser.php
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Contexts\AbstractContext;
66
use App\Contexts\ArrayValue;
7+
use App\Contexts\ObjectValue;
78
use Microsoft\PhpParser\MissingToken;
89
use Microsoft\PhpParser\Node;
910
use Microsoft\PhpParser\Node\Expression\ArrayCreationExpression;
@@ -16,14 +17,14 @@ class ArrayCreationExpressionParser extends AbstractParser
1617
*/
1718
protected AbstractContext $context;
1819

19-
private function isParentNode(Node $node, string $nodeClass): bool
20+
private function isParentNode(Node $node, array $nodeClasses): bool
2021
{
2122
if ($node->getParent() !== null) {
22-
if ($node->getParent() instanceof $nodeClass) {
23+
if (collect($nodeClasses)->contains(get_class($node->getParent()))) {
2324
return true;
2425
}
2526

26-
return $this->isParentNode($node->getParent(), $nodeClass);
27+
return $this->isParentNode($node->getParent(), $nodeClasses);
2728
}
2829

2930
return false;
@@ -33,8 +34,8 @@ public function parse(ArrayCreationExpression $node)
3334
{
3435
// If array is inside a method, for example Validator::validate(['
3536
// then we need to ignore findable for ArrayValue because
36-
// priority is given to App\Contexts\MethodCall
37-
if (!$this->isParentNode($node, CallExpression::class)) {
37+
// priority is given to App\Contexts\MethodCall or App\Contexts\ObjectValue
38+
if (!$this->isParentNode($node, [CallExpression::class, ObjectValue::class])) {
3839
$this->context->findable = true;
3940
}
4041

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.