Feature Request: Please address this plugin's conflicts with `php-stubs/wordpress-stubs`
montchr opened this issue · 11 comments
Terms
- I have read the guidelines for Contributing to Roots Projects
- This request is not a duplicate of an existing issue
- This is not a personal support request that should be posted on the Roots Discourse community
Summary
It is currently not possible to use phpstan
with phpstan-wordpress
and the wordpress-stubs
packages when installing roots/wp-password-bcrypt
via composer.json
without resorting to some very hacky (and unreliable/repetitive/frustrating) workarounds.
The full issue is described in szepeviktor/phpstan-wordpress#41.
Motivation
Why are we doing this?
To reduce the frustration of working with WordPress, to improve compatibility, and to facilitate reproducible development tasks in local and CI workflows.
Please read:
I am aware this has been mentioned indirectly in the past, but it appears that there has been little consideration given to making a change in this plugin despite the numerous accounts over the years. I am referring specifically to #11, but there are other examples.
It would be great if roots/wp-password-bcrypt
could find a way to improve compatibility with these other libraries, because both this plugin and those libraries have been positive improvements to the WordPress ecosystem that unfortunately do not mix well.
What use cases does it support?
- Using the widely-used
phpstan
static analysis tooling with WordPress integration via https://github.com/szepeviktor/phpstan-wordpress - Using this plugin via Composer installation
What is the expected outcome?
Developers and CI pipelines should be able to run phpstan analyse
when this plugin is installed via composer.json
and the WordPress stubs are loaded without any conflict.
I encourage the authors of this plugin to listen to the feedback from other developers who have encountered such conflicts and have given specific suggestions as to a fix.
For example:
Check if function exists in wordpress-stubs.php · Issue #70 · php-stubs/wordpress-stubs
I've given a couple of workshops on WordPress+PHPStan and both times this exact problem was the first to arise. We determined that the most correct solution is for the Bedrock bcrypt library to wrap its functions in
function_exists()
checks because it has no way to ensure that another definition of one of those functions isn't loaded by another plugin. I'm not sure why that is not the case.
Potential conflicts / foreseeable issues
Unknown. I am only a user of both tools reporting my experience and, more importantly, linking the two GitHub issues together because it looks like there's only been isolated conversations in each repo about this issue.
Additional Context
No response