Problem/Motivation
Looks like a lot of dependency hell around these days...
Steps to reproduce
With Drupal 10.0.0, core requires twig/twig:^3.
drush en cl_components
PHP Fatal error: Declaration of Drupal\cl_components\Twig\TwigComponentLoader::isFresh($name, $time) must be compatible with Twig\Loader\LoaderInterface::isFresh(string $name, int $time): bool in cl_components/src/Twig/TwigComponentLoader.php on line 158
Proposed resolution
Let's think, covariance, contravariance, i suppose if we don't want to start a new major version, and don't want to break D9 installs that iirc use untyped twig/twig:^2, we must typehint parameters, but not return value. Nope, it's the other way round.
Remaining tasks
Code, MR, review, commit.
Issue fork cl_components-3333906
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
geek-merlinComment #3
geek-merlinComment #5
geek-merlinApplied the MR with composer-patches, enabled, fixes the issue for me.
Comment #7
b_sharpe commentedRebased and removed unneeded space.
Comment #8
e0ipsoI have yet to port the tests in SDC to CL Components. Can anyone tests that this patch also works well with Drupal 9 and Twig 2?
Comment #9
arisenApplied the patch from the MR on Drupal 10.0.0.
It applies cleanly:
The drush installation error is resolved after applying the patch.
Regarding Drupal 9:
The module installation works fine without the patch(tried on Drupal 9.5.4).
The function signature is matching as declared in the LoaderInterface.
public function isFresh($name, $time);The module installation works fine on Drupal 9 even after applying the patch.
Moving this to RTBC.
Comment #11
e0ipsoThis was merged. Thanks for the contribution.