Skip to content
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

Handle intersection types with parentheses #1321

Closed
leofeyer opened this issue May 8, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@leofeyer
Copy link

commented May 8, 2019

Subject Details
Plugin EA Extended v3.0.13
Language level PHP 7.3

Please add support for intersection types with parentheses, so the plugin supports @param (Foo&MockObject)|null in addition to @param Foo&MockObject.

  • Foo&MockObject: the argument is an object of both class Foo and class MockObject
  • (Foo&MockObject)|null: the argument is an object of both class Foo and class MockObject or null

As explained by @ondrejmirtes in phpstan/phpstan#1877, the parentheses are required to disambiguate the annotation. However, neither PhpStorm itself nor the EA Extended plugin understand the syntax:

See https://youtrack.jetbrains.com/issue/WI-45275 for the PhpStorm bug report.

@kalessil

This comment has been minimized.

Copy link
Owner

commented May 9, 2019

Silly question, before I do investigation: will the issue remain with https://plugins.jetbrains.com/plugin/9674-phpunit-enhancement plugin installed?

@kalessil kalessil self-assigned this May 9, 2019

@kalessil kalessil added the question label May 9, 2019

@kalessil kalessil added this to the C-3.0.14 milestone May 9, 2019

@leofeyer

This comment has been minimized.

Copy link
Author

commented May 9, 2019

I am pretty sure the issue will remain.

@kalessil

This comment has been minimized.

Copy link
Owner

commented May 9, 2019

Ok, I'll check then. Most probably we have to wait for PhpStorm ticket to happen (as we heavily using the type resolver from the IDE).

@leofeyer

This comment has been minimized.

Copy link
Author

commented May 9, 2019

I think so, too.

@kalessil

This comment has been minimized.

Copy link
Owner

commented May 15, 2019

Checked, I'll enhance type-resolving on our end for mocking support. I also can disable the inspection in test context but will keep t as plan "B".

kalessil added a commit that referenced this issue May 20, 2019

@kalessil

This comment has been minimized.

Copy link
Owner

commented May 20, 2019

Fixed (test-context gets skipped)!

@leofeyer

This comment has been minimized.

Copy link
Author

commented May 21, 2019

Thank you @kalessil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.