Closed felixfbecker closed 7 years ago
I get a very similar message after updating to the latest 3.0.x-dev
:
PHP message: PHP Fatal error: Uncaught Error: Call to a member function unregister() on boolean in /app/vendor/squizlabs/php_codesniffer/autoload.php:65
Stack trace:
#0 [internal function]: PHP_CodeSniffer\Autoload::load('Go\\ParserReflec...')
#1 /app/vendor/goaop/parser-reflection/src/bootstrap.php(17): spl_autoload_call('Go\\ParserReflec...')
#2 /app/vendor/composer/autoload_real.php(66): require('/app/vendor/goa...')
#3 /app/vendor/composer/autoload_real.php(56): composerRequire35a8a66d127a5aa3a9c6513497d56b06('950e8c5ec01dc90...', '/app/vendor/com...')
#4 /app/vendor/autoload.php(7): ComposerAutoloaderInit35a8a66d127a5aa3a9c6513497d56b06::getLoader()
#5 /app/frontend/web/index.php(3): require('/app/vendor/aut...')
#6 {main}
For me, changing the required version in composer.json
to "squizlabs/php_codesniffer": "3.0.0RC2"
worked fine (in case anyone looks for a quick solution until branch is fixed).
@felixfbecker you could also include CodeSniffer at a specific commit, for now. The one after your needed patch but before the breaking changes:
"squizlabs/php_codesniffer": "dev-master#09dba39a88e327ee75814b921fcae85904562262"
My example is just a random commit from few days ago.
@ddinchev look at the composer.json, that is exactly how it is referenced. Composer doesn't care apparently, and the docs say the feature is not actively supported and bug reports will not be accepted.
I'm currently redoing the way autoloading works with composer in the 3.0 branch (started last week as part of #1259) so that's why you're seeing issues. It's a shame the commit-specific inclusion isn't working for you because I think the 3.0 branch might be a bit unstable for a bit longer. I'll try and get it working as soon as I can though.
Also note that this was reported here: https://github.com/squizlabs/PHP_CodeSniffer/pull/1322
See my comment for why I can't merge that in. But it's what I'm actively working on.
@gsherwood Thanks for the response. As I said this is pretty urgent because this broke our build and the commit reference is not working. My only other option is to remove this dependency, which would be a huge breaking change as I would have to remove the whole formatting feature.
Could you maybe tag an the old commit e8acf8e029301b0e3ea7e7c9eef0aee914db78bf as RC3 until we have a more stable version again? That one is the one I am trying to pin on, which passes all my tests and includes an important bug fix over RC2.
@felixfbecker I've just pushed a change that might fix it for you. Can you test that if you get a chance please.
Works, build is green again, thanks. But I would really like for some way to prevent this in the future (I wasn't aware I couldn't depend on a commit hash like that with Composer).
But I would really like for some way to prevent this in the future
Then you'd need to stick to the tagged releases I guess. I don't know much about composer though, so maybe there is a solution in there somewhere.
Thanks for testing it.
@gsherwood Any chance of another RC release in the near future? I think that would resolve the issue. Or a full 3.0.0 release? Checked the 3.0.0 milestone here to see if there was anywhere I could help out, but there's nothing there.
The issue wasn't in the last RC release. I only committed that code last week while I was reworking the autoloader. So if you're already using the 3.0 branch, you can update and get the fix now. If you using RC2, you won't be getting any composer autoloading through PHPCS.
Installing the 3.0.x-dev branch results in
I have to install from the branch because the RC2 is missing an important bug fix, this now broke my builds :/