-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
False positive when slashing data for wp_insert_post() and wp_update_post() #54
Comments
Hello @Chouby! 👋🏻 There are many options open.
|
Oh no! We already have PHP generics * @param string|array $value String or array of data to slash.
* @return string|array Slashed `$value`.
* @phpstan-template T
* @phpstan-param T $value
* @phpstan-return T
*/
function wp_slash($value) |
Actually I do not know why arrays don't keep their shape. |
@ondrejmirtes Could you help why PHP generics does not keep array shapes? |
Please reproduce the problem on phpstan.org/try and open a discussion in PHPStan's GitHub, thanks. |
@ondrejmirtes Thank you. |
@Chouby Please temporarily edit WP stubs for |
wp_insert_post()
is expecting slashed data. So I'm used to prepare data passed towp_insert_post()
andwp_update_post()
withwp_slash()
.Here is a small sample to demonstrate the issue:
Since the version 6.0.2 (I suppose since #49), PHPStan reports the following error on:
If I remove
wp_slash()
, PHPstan would report nothing.The text was updated successfully, but these errors were encountered: