Comments (4)
I don't know- I was just looking at the test cases and I'm not sure why you can use it on some code that references that name, but not in the use
statement. If it makes sense, we could change that.
from tolerant-php-parser.
Hi, thanks for the feedback. Maybe it has something to do with the crazy things you can do with the insteadof
and as
keywords. See "Conflict resolution" in https://www.php.net/manual/en/language.oop5.traits.php .
from tolerant-php-parser.
But then again, I can't imagine this be the reason... I tried commenting out Node\TraitUseClause
to see if any of the tests in php-intellisense break and there was no problem - if something, some things I missed got fixed.
public function getResolvedName($namespaceDefinition = null) {
// Name resolution not applicable to constructs that define symbol names or aliases.
if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStartPosition() === $this->getStartPosition()) ||
$this->parent instanceof Node\Statement\NamespaceUseDeclaration ||
$this->parent instanceof Node\NamespaceUseClause ||
$this->parent instanceof Node\NamespaceUseGroupClause ||
/*$this->parent->parent instanceof Node\TraitUseClause ||*/
$this->parent instanceof Node\TraitSelectOrAliasClause
) {
return null;
}
I have not yet managed to wrap my head around TraitSelectOrAliasClause
where in the parsers it's being used.
from tolerant-php-parser.
I cannot figure out why @mousetraps prohibited this. use Trait
works much the same way as use Namespace
- in the sense of resolving to FQN.
Even the other case of TraitSelectOrAliasClause
is useless here because the following code
class TestClazz
{
use TestTrait {
TestTrait::test2 as testX;
}
Gets constructed into: TraitUseClause
-> TratSelectOrAliasClauseList
-> TraitSelectOrAliasClause
-> ScopedPropertyAccessExpression
-> QualifiedName
.
And such $this->parent instanceof Node\TraitSelectOrAliasClause
should actually be $this->parent->parent instanceof Node\TraitSelectOrAliasClause
to have any effect.
Then again it still does not make sense to have this as even here the QualifiedName
can be resolved without any extra logic or context.
(unless I'm missing something)
Making a PR.
from tolerant-php-parser.
Related Issues (20)
- Publish a 0.0.23 release? HOT 1
- Project motivation / VS Code / IDE support? HOT 7
- Publish a 0.0.25 release?
- Support php 8.1 intersection types, new token constants
- Spurious failure on nested conditionals without parentheses
- Single word namespaces which are reserved words produce an error incorrectly HOT 1
- `match` is not categorized as Keyword HOT 1
- Support parsing php 8.2 Disjunctive Normal Form types (`(A&B)|C`) HOT 1
- Support php 8.1 `never` return type, add to returnTypeDeclarationTokens
- Using `void` as a parameter/property type is a compilation error, not a parse error
- Publish a new release supporting php 8.2 syntax? HOT 10
- Idea: Start converting older tokenization to php 8.0 T_NAME_QUALIFIED/T_NAME_RELATIVE/T_NAME_FULLY_QUALIFIED
- Support `__halt_compiler` as a member of the top level statements
- PHP 8.2 would deprecate dynamic properties by default: Consider `#[\AllowDynamicProperties]`
- Regression with namespace names vs. MissingToken HOT 2
- match is a valid method name HOT 2
- EnumDeclaration does not support classInterfaceClause HOT 1
- Quoted string parsing doesn't work as expected
- Migrate Travis CI checks to GitHub workflows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tolerant-php-parser.