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

Incompatibility with PSR\Log #1127

Open
mikemadison13 opened this issue Nov 2, 2022 · 3 comments
Open

Incompatibility with PSR\Log #1127

mikemadison13 opened this issue Nov 2, 2022 · 3 comments

Comments

@mikemadison13
Copy link

Setting up a new Drupal 10 project using Acquia BLT (which is built using Robo 3.x) I am noticing that...

Drupal 10.x requires psr/log 3.x. However, robo has a setLogger method (https://github.com/consolidation/robo/blob/3.x/src/Common/TaskIO.php#L30) that isn't compatible with the psr/log 3.x (https://github.com/php-fig/log/blob/master/src/LoggerInterface.php#L124). So, spinning up a new codebase that has robo 3.x and Drupal 10.x I am hitting:

PHP Fatal error:  Declaration of Robo\Task\BaseTask::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void in /Users/mike.madison/git/examples/drupal10/vendor/consolidation/robo/src/Common/TaskIO.php on line 30

Fatal error: Declaration of Robo\Task\BaseTask::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void in /Users/mike.madison/git/examples/drupal10/vendor/consolidation/robo/src/Common/TaskIO.php on line 30

Steps to reproduce

In this case, I'm using... acquia/blt and drupal/10 and hitting this.

Expected behavior

If robo has a specific version of psr/log it is functional with, I would expect a version constraint in composer.json

Actual behavior

Robo requires consolidation/log which allows psr/log 3.x which itself isn't compatible with consolidation/robo 3.0.10

@greg-1-anderson
Copy link
Member

Robo 3.x requires consolidation/log ^1 || ^2; neither of those have any stable releases that allow psr/log ^3, and HEAD of 2.x similarly disallows psr/log ^3. There may be come Composer oddity that is allowing an older version of psr/log 2.x-dev which might have incorrectly allowed psr/log ^3, before being fixed. This sort of nightmare is possible if you use minimum-stability: dev.

If any such stray commit does exist and is identified, I don't know if there is a way to unpublish it on Packagist, but I will if I can.

@mikemadison13
Copy link
Author

I think looking at my setup...

BLT Requires Robo 3.x (which requires consolidation log 2.x)
My project requires Drupal 10.x (which requires psr/log 3.x)

Composer managed to grab the e95baffd51cedc2b553d94339d364b96c698a963 commit hash, which creates the situation where robo and log co-exist in an environment where it shouldn't.

@greg-1-anderson
Copy link
Member

That's odd, GitHub says that commit is on the 3.x branch, not the 2.x. It shouldn't be allowed with Robo 3, as far as I can tell. Avoiding minimum-stability dev is always the best bet, though, as Composer can get weird with dev releases.

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

No branches or pull requests

2 participants