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

Better support for string literals when defining types #5758

Closed
mind-bending-forks opened this issue Oct 8, 2021 · 3 comments
Closed

Better support for string literals when defining types #5758

mind-bending-forks opened this issue Oct 8, 2021 · 3 comments

Comments

@mind-bending-forks
Copy link

Feature request

It would be wonderful if PHP Stan didn't throw errors for this example:

https://phpstan.org/r/fea50f42-6a4b-41d7-8bf6-14feee0b0be8

@phpstan-bot
Copy link
Contributor

@mind-bending-forks After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-11: Offset 'a-param' does not exist on array('type' => 'a', 'a-param' => string)|array('type' => 'a', 'b-param' => string).
-15: Offset 'b-param' does not exist on array('type' => 'b', 'a-param' => string)|array('type' => 'b', 'b-param' => string).
+11: Offset 'a-param' does not exist on array{type: 'a', a-param: string}|array{type: 'a', b-param: string}.
+15: Offset 'b-param' does not exist on array{type: 'b', a-param: string}|array{type: 'b', b-param: string}.
Full report
Line Error
11 `Offset 'a-param' does not exist on array{type: 'a', a-param: string}
15 `Offset 'b-param' does not exist on array{type: 'b', a-param: string}

@phpstan-bot
Copy link
Contributor

@mind-bending-forks After the latest push in 1.8.x, PHPStan now reports different result with your code snippet:

@@ @@
-11: Offset 'a-param' does not exist on array('type' => 'a', 'a-param' => string)|array('type' => 'a', 'b-param' => string).
-15: Offset 'b-param' does not exist on array('type' => 'b', 'a-param' => string)|array('type' => 'b', 'b-param' => string).
+No errors

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants