Store and retrieve nodes by address
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 17.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
Is it possible to retrieve a node address (path) in visitor class callback methods? I'd like to re-access nodes with cached data.
I'm looking for something like $node->address in the code below. I know such a property does not exist.
class MyNodeAddressCollectionVisitor extends NodeVisitorAbstract
{
public function leaveNode(Node $node) {
$nodeAddress = $node->address;
}
}
Also I'm looking for a way to retrieve a node object by specifying its address,
$node = $stmts->getNode($nodeAddress);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The request centers on NodeVisitorAbstract callback methods, especially leaveNode(), and the statement collection represented by $stmts. Start by tracing how visitor callbacks receive Node objects and how statement nodes are stored; done would provide a defined way to obtain node addresses and retrieve nodes from those addresses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100