Problem/Motivation

AutowiredInstanceTrait::createInstanceAutowired() contains the following code.

if (!$container->has($service)) {
  if ($parameter->allowsNull()) {
    $args[] = NULL;
    continue;
  }
  throw new AutowiringFailedException($service, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s::_construct()", you should configure its value explicitly.', $service, $parameter->getName(), static::class));
}

The constructor name is wrong: It is __construct() with two underscores, like all the magic methods, not _construct().

Proposed resolution

Change the previously quoted code to the following one.

if (!$container->has($service)) {
  if ($parameter->allowsNull()) {
    $args[] = NULL;
    continue;
  }
  throw new AutowiringFailedException($service, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s::__construct()", you should configure its value explicitly.', $service, $parameter->getName(), static::class));
}

Issue fork drupal-3554801

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

avpaderno created an issue. See original summary.

avpaderno’s picture

Issue summary: View changes

avpaderno’s picture

Status: Active » Needs review
idebr’s picture

Status: Needs review » Needs work
avpaderno’s picture

Assigned: Unassigned » avpaderno
avpaderno’s picture

Assigned: avpaderno » Unassigned
Status: Needs work » Needs review

@idebr Thank you! If I understood correctly the report, only two tests were failing.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Bug Smash Initiative

Seems straight forward. Believe random failure in JavaScript test

  • longwave committed c1d51a81 on 11.3.x
    fix: #3554801 The exception thrown by AutowiredInstanceTrait::...

  • longwave committed 3ecd3c65 on 11.x
    fix: #3554801 The exception thrown by AutowiredInstanceTrait::...
longwave’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Good spot. Committed and pushed to 11.x and 11.3.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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