ColorboxCommands::__construct should type against interface

Created on 17 May 2022, about 2 years ago
Updated 7 June 2023, about 1 year ago

Problem/Motivation

The method definition for ColorboxCommands::__construct() uses LibraryDiscovery as a type hint instead of the interface, which will result in errors if the service implementation is changed.

TypeError: Drupal\colorbox\Commands\ColorboxCommands::__construct(): Argument #1 ($library_discovery) must be of type Drupal\Core\Asset\libraryDiscovery, Drupal\attachinline\Asset\LibraryDiscoveryDecorator given, called in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\colorbox\Commands\ColorboxCommands->__construct() (line 34 of /app/web/modules/contrib/colorbox/src/Commands/ColorboxCommands.php).

Steps to reproduce

Install a module that swaps or decorates the library.discovery service.

Proposed resolution

Change type hint to LibraryDiscoveryInterface

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada gapple

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.

Production build 0.69.0 2024