Fatal error on install

Created on 16 January 2023, over 1 year ago
Updated 22 March 2023, over 1 year ago

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.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Assigned to geek-merlin
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • First commit to issue fork.
  • 🇨🇦Canada b_sharpe

    Rebased and removed unneeded space.

  • e0ipso Can Picafort

    I 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?

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India arisen Goa

    Applied the patch from the MR on Drupal 10.0.0.

    It applies cleanly:

    Checking patch src/Twig/TwigComponentLoader.php...
    Applied patch src/Twig/TwigComponentLoader.php 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.

  • Status changed to Fixed over 1 year ago
  • e0ipso Can Picafort

    This was merged. Thanks for the contribution.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024