Add rule to suggest replacing WP constants with function calls#276
Add rule to suggest replacing WP constants with function calls#276szepeviktor merged 1 commit intoszepeviktor:2.xfrom
Conversation
|
Are we in the space age? 🙃 |
If this is the case, it would apply to all other constants that are likely to have values different from those defined in |
phpstan-wordpress/composer.json Line 15 in 6686dc2 @westonruter it was your PR. |
Make it so. |
|
Going in ... |
Adds a rule that checks for the use of certain WordPress constants. If such constants are found, an error will be triggered, suggesting replacing the constant with a function call.
I also suggest removing the following lines:
https://github.com/szepeviktor/phpstan-wordpress/blob/6686dc2412cdf544556d428e67aa8f0b645164ca/bootstrap.php#L69C1-L72C49
as
STYLESHEETPATHandTEMPLATEPATHwere deprecated in WordPress v6.4.0. Additionally, these constants may need to be added todynamicConstantNamesto avoid always-true and always-false errors.