question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invalid ast for `{` and `}`

See original GitHub issue

Input:

$var = $foo->bzr_{1};
$var = $foo->bzr_{'string'};
$var = $foo->bzr_{$baz};
$var = $foo->bzr_{$baz->foo};
$var = $foo->bzr_{$var ? 'one' : 'two'};

Parsed as encapsed with offset, but it is just offsetlookup with curly brackets

Should be parse as:

$var = $foo->bzr_[1];
$var = $foo->bzr_['string'];
$var = $foo->bzr_[$baz];
$var = $foo->bzr_[$baz->foo];
$var = $foo->bzr_[$var ? 'one' : 'two'];

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alexander-akaitcommented, Aug 28, 2019
1reaction
alexander-akaitcommented, Aug 28, 2019

It is same code, look

$var = true;

$foo = new class {
    var $bzr_ = ['one' => 'foo'];
};

echo $foo->bzr_{$var ? 'one' : 'two'};
echo $foo->bzr_[$var ? 'one' : 'two'];
Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid AST Node: {"input":"** } on graphql mutation (Amplify ...
I created all items and then I tried to delete them but I failed especially on PostEditor. There is a mutation to delete...
Read more >
Getting "Error: Invalid AST Node..." when using useQuery #1372
Describe the bug I am trying to use vue apollo client with a vue2 project that uses the @vue/composition-api plugin.
Read more >
Apollo AST - Apollo GraphQL Docs
Apollo Kotlin's parser has its own module ( apollo-ast ), which you can use ... The following snippet parses and validates a short...
Read more >
Valloric/YouCompleteMe - Gitter
but if somehow clangd is setup differently, then this is a red herring and the "invalid AST" error is something else. although I...
Read more >
ASTNode (JavaScript Development Tools API Specification)
An AST node represents a JavaScript source code construct, such as a name, type, expression, ... void, setSourceRange(int startPosition, int length)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found