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

wp_die return type is wrong #248

Closed
kkmuffme opened this issue Oct 10, 2024 · 14 comments · Fixed by #251
Closed

wp_die return type is wrong #248

kkmuffme opened this issue Oct 10, 2024 · 14 comments · Fixed by #251

Comments

@kkmuffme
Copy link

kkmuffme commented Oct 10, 2024

https://github.com/php-stubs/wordpress-stubs/blame/v6.6.2/functionMap.php#L56

  • has 1 ) too much at the end
  • array{exit: false} is wrong, since the array can have other keys in it too, e.g. code and the correct type would be array{exit: false}&array

https://developer.wordpress.org/reference/functions/wp_die/

@kkmuffme
Copy link
Author

kkmuffme commented Oct 10, 2024

This same mistake is there for other stuff too - e.g. wp_list_bookmarks, wp_list_categories,... since those all are for sealed array shapes but should be unsealed

@szepeviktor
Copy link
Member

szepeviktor commented Oct 10, 2024

@kkmuffme How many laser eyes do you have? 🙃

IanDelMar added a commit to IanDelMar/wordpress-stubs that referenced this issue Oct 10, 2024
@IanDelMar
Copy link
Contributor

  • array{exit: false} is wrong, since the array can have other keys in it too, e.g. code and the correct type would be array{exit: false}&array

Each of these is tested with an additional key. None of the tests are failing. Why is this?

@kkmuffme
Copy link
Author

Maybe because phpstan doesn't seal arrays by default (like how it was in psalm pre-v5)?

szepeviktor pushed a commit that referenced this issue Oct 10, 2024
@IanDelMar
Copy link
Contributor

For PHPStan array{exit: false}&array = array{exit: false}. This is different in Psalm?

@kkmuffme
Copy link
Author

Yes (as it should be, since that behavior you just described was a bad design choice taken in psalm initially and copied by everybody)

@IanDelMar
Copy link
Contributor

IanDelMar commented Oct 10, 2024

The problem is that you’re using Psalm, and therefore array{exit: false} doesn’t work as expected?

@szepeviktor Perhaps we could add support for this? See phpstan/phpdoc-parser#169.

@kkmuffme
Copy link
Author

No, the problem is not that I'm using Psalm, it's that your type is wrong. If you want to know why, look up why we changed the behavior in psalm

@szepeviktor
Copy link
Member

I do not want to work on this package & I keep a distance from Psalm.

@kkmuffme
Copy link
Author

I do not want to work on this package

Don't need to, the fix will be PRed anyway.
Maybe add other maintainers?

I keep a distance from Psalm

Why? :-)

@szepeviktor
Copy link
Member

I keep a distance from Psalm

Why? :-)

It has dark roots. That is all. I do not want to spark emotions.

@kkmuffme
Copy link
Author

If I may ask bc I'm unaware (and have contributed quite a bit to psalm): bc of initial funding of psalm? or personal experience with psalm's team?

@szepeviktor
Copy link
Member

Sorry. That is all. I've read it on psalm.dev many years ago.

@IanDelMar
Copy link
Contributor

@kkmuffme I’d appreciate it if you could have a look at #251.

szepeviktor pushed a commit that referenced this issue Oct 10, 2024
* Use unsealed shapes in conditional return types

#248

* Remove mistakenly added unsealed shapes

* Replace ... notation with pseudo intersections

* Replace ... notation with pseudo intersections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants