Skip to content

Commit

Permalink
Support Drupal core 11 (#27)
Browse files Browse the repository at this point in the history
* Update README.md

* Update PackageRequiresAdjuster.php

* Update PackageRequiresAdjusterTest.php
  • Loading branch information
RuZniki committed Dec 7, 2023
1 parent 5a0e67f commit 6f9e03f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See [Add a composer plugin that supports 'composer require-lenient' to support m

This subscribes to `PluginEvents::PRE_POOL_CREATE` and filters packages. This is inspired by `symfony/flex`, but it does
not filter out packages. It rewrites the `drupal/core` constraint on any package with a type of `drupal-*`,
excluding `drupal-core`. The constraint is set to `'^8 || ^9 || ^10'` for `drupal/core`.
excluding `drupal-core`. The constraint is set to `'^8 || ^9 || ^10 || ^11'` for `drupal/core`.

## Try it

Expand Down
2 changes: 1 addition & 1 deletion src/PackageRequiresAdjuster.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(
private readonly Composer $composer

This comment has been minimized.

Copy link
@estebanvalerioh

estebanvalerioh Dec 15, 2023

I'm getting this error when running composer install:

  - Installing mglaman/composer-drupal-lenient (1.0.4): Extracting archive
    Install of mglaman/composer-drupal-lenient failed

In PackageRequiresAdjuster.php line 22:
                                                                      
  [ParseError]                                                        
  syntax error, unexpected identifier "Composer", expecting variable  
                                                                      

Exception trace:
  at /app/vendor/mglaman/composer-drupal-lenient/src/PackageRequiresAdjuster.php:22
 Composer\Autoload\{closure}() at phar:https:///usr/local/bin/composer/vendor/composer/ClassLoader.php:427
 Composer\Autoload\ClassLoader->loadClass() at /app/vendor/mglaman/composer-drupal-lenient/src/Plugin.php:31
 ComposerDrupalLenient\Plugin->activate() at phar:https:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:391
 Composer\Plugin\PluginManager->addPlugin() at phar:https:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:295
 Composer\Plugin\PluginManager->registerPackage() at phar:https:///usr/local/bin/composer/src/Composer/Installer/PluginInstaller.php:85
 Composer\Installer\PluginInstaller->Composer\Installer\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:169
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:176
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:173
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:176
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:176
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Internal/FulfilledPromise.php:47
 React\Promise\Internal\FulfilledPromise->then() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:176
 React\Promise\Promise::React\Promise\{closure}() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:217
 React\Promise\Promise->settle() at phar:https:///usr/local/bin/composer/vendor/react/promise/src/Promise.php:279
 React\Promise\Promise::React\Promise\{closure}() at n/a:n/a
 call_user_func() at phar:https:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php:328
 Composer\Util\ProcessExecutor->countActiveJobs() at phar:https:///usr/local/bin/composer/src/Composer/Util/Loop.php:90
 Composer\Util\Loop->wait() at phar:https:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:430
 Composer\Installer\InstallationManager->waitOnPromises() at phar:https:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:405
 Composer\Installer\InstallationManager->executeBatch() at phar:https:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:319
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:https:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:218
 Composer\Installer\InstallationManager->execute() at phar:https:///usr/local/bin/composer/src/Composer/Installer.php:804
 Composer\Installer->doInstall() at phar:https:///usr/local/bin/composer/src/Composer/Installer.php:292
 Composer\Installer->run() at phar:https:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:147
 Composer\Command\InstallCommand->execute() at phar:https:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:https:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:https:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:https:///usr/local/bin/composer/src/Composer/Console/Application.php:382
 Composer\Console\Application->doRun() at phar:https:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:https:///usr/local/bin/composer/src/Composer/Console/Application.php:145
 Composer\Console\Application->run() at phar:https:///usr/local/bin/composer/bin/composer:93
 require() at /usr/local/bin/composer:29

This comment has been minimized.

Copy link
@estebanvalerioh

estebanvalerioh Dec 15, 2023

For some reason my PHP version got updated, after using 8.1 it worked

This comment has been minimized.

Copy link
@mglaman

mglaman Dec 16, 2023

Owner

Wait, do you mean it failed on 8.2?

) {
$this->drupalCoreConstraint = (new VersionParser())
->parseConstraints('^8 || ^9 || ^10');
->parseConstraints('^8 || ^9 || ^10 || ^11');
}

public function applies(PackageInterface $package): bool
Expand Down
5 changes: 3 additions & 2 deletions tests/PackageRequiresAdjusterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function testAdjust(?string $coreVersion, string $expectedCoreConstraintS
$originalDrupalCoreConstraint = new MultiConstraint([
new Constraint('>=', '8.0'),
new Constraint('>=', '9.0'),
new Constraint('>=', '10.0'),
]);
$originalTokenConstraint = new Constraint('>=', '1.10.0');
$package = new CompletePackage('foo', '1.0', '1.0');
Expand Down Expand Up @@ -128,8 +129,8 @@ public function testAdjust(?string $coreVersion, string $expectedCoreConstraintS
public function provideAdjustData(): array
{
return [
[null, '^8 || ^9 || ^10'],
['10.0.0-alpha5', '^8 || ^9 || ^10'],
[null, '^8 || ^9 || ^10 || ^11'],
['10.0.0-alpha5', '^8 || ^9 || ^10 || ^11'],
];
}
}

0 comments on commit 6f9e03f

Please sign in to comment.