10000 [Config] Use intersection type when referring to ParentNodeDefinitionInterface by thewilkybarkid · Pull Request #28912 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Config] Use intersection type when referring to ParentNodeDefinitionInterface #28912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2018

Conversation

thewilkybarkid
Copy link
Contributor
@thewilkybarkid thewilkybarkid commented Oct 18, 2018
Q A
Branch? 2.8
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Allows PHPStan to understand it correctly (refs libero/content-api-bundle#2 (comment)).

PHPStorm 2018.3 will add support for it too, but to help older versions I've reversed the order (so NodeDefinition is recognised).

@@ -133,7 +133,7 @@ public function variableNode($name)
/**
* Returns the parent node.
*
* @return ParentNodeDefinitionInterface|NodeDefinition The parent node
* @return NodeDefinition&ParentNodeDefinitionInterface The parent node
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any occurrence of this syntax in the codebase.
Can you check if it's compatible with usual tooling, eg phpstorm, phpdocumentor, etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next version of PHPStorm will support it (and falls back to the first type currently); there's a well-timed proposal for PSR-5; untested but phpDocumentor probably doesn't work.

This syntax was in https://wiki.php.net/rfc/intersection_types too.

@fabpot
Copy link
Member
fabpot commented Nov 26, 2018

Thank you @thewilkybarkid.

@fabpot fabpot merged commit e9cdabe into symfony:2.8 Nov 26, 2018
fabpot added a commit that referenced this pull request Nov 26, 2018
…odeDefinitionInterface (thewilkybarkid)

This PR was merged into the 2.8 branch.

Discussion
----------

[Config] Use intersection type when referring to ParentNodeDefinitionInterface

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Allows PHPStan to understand it correctly (refs libero/content-api-bundle#2 (comment)).

PHPStorm 2018.3 will add support for it too, but to help older versions I've reversed the order (so `NodeDefinition` is recognised).

Commits
-------

e9cdabe Use intersection type when referring to ParentNodeDefinitionInterface
@thewilkybarkid thewilkybarkid deleted the node-builder-intersection branch November 26, 2018 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0