Problem/Motivation

The module throws a type error in a construct method when installing and enabling on a site that uses the storybook module. The error message is the following:

TypeError: Drupal\pwa\Form\ManifestConfigurationForm::__construct(): Argument #8 ($fileUrlGenerator) must be of type Drupal\Core\File\FileUrlGenerator, Drupal\storybook\FileUrlGenerator given, called in /var/www/html/web/modules/contrib/pwa/src/Form/ManifestConfigurationForm.php on line 158 in Drupal\pwa\Form\ManifestConfigurationForm->__construct() (line 114 of modules/contrib/pwa/src/Form/ManifestConfigurationForm.php).

Steps to reproduce

Install and enable the storybook module with the pwa module enabled and navigate to the settings page for PWA (/admin/config/services/pwa/manifest).

Proposed resolution

Use the FileUrlGeneratorInterface type instead of FileUrlGenerator type for the method argument that throws the error.
(See #3470148: Type error when installing the storybook module)

Issue fork pwa-3488388

Command icon 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

joshahubbers created an issue. See original summary.

joshahubbers’s picture

Title: Type error when installing the storybook module » Type error when installing while using the storybook module
sourav_paul’s picture

Status: Active » Needs review
ambient.impact’s picture

Yikes. Reminds of when the Hux module started out and discovered there were a few modules that were type hinting to the ModuleHandler class instead of ModuleHandlerInterface like they should have. I'm thinking we should expand the scope of this issue to fix any other instances in the module where we're type hinting to classes rather than interfaces. What do you all say?

anybody’s picture

Version: 2.1.0-beta6 » 2.x-dev
Status: Needs review » Reviewed & tested by the community

Important fix! Thank you!

anybody’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

kryber’s picture

ambient.impact: yeah!