Removed the code snippet mentioned in #11

Comments

mikelutz created an issue. See original summary.

alexpott’s picture

Imo this is something we fix in drupal 9 by removing this code because it breaks with Symfony 4. We don't want to provide a BC / feature layer for Drupal 9 to support this. And nothing in core actually triggers this error. There's nothing we can do here on d8... people need to do as the deprecation says... Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s"...

So I'd recommend moving this issue to Drupal 9.

mikelutz’s picture

Version: 8.8.x-dev » 9.x-dev
Status: Active » Postponed

Postponed on D9 branch opening

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.

xjm’s picture

Status: Postponed » Active
Issue tags: +beta target

I expected that this issue would have been solved elsewhere during D9 development, but I just grepped and:

[ibnsina:drupal | Wed 21:30:33] $ grep -r "addAutowiringType" *
core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php:                $definition->addAutowiringType($service['autowiring_types']);
core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php:                    $definition->addAutowiringType($autowiringType);

Is there something we should try to do here as a beta target? What would a fix look like?

longwave’s picture

This issue would be sidestepped if we did #3111008: Use native Symfony YamlFileLoader instead.

pasqualle’s picture

Version: 9.0.x-dev » 9.2.x-dev
xjm’s picture

Issue tags: -beta target

Cleaning up leftover beta targets from 9.0.x.

Pooja Ganjage’s picture

StatusFileSize
new1.25 KB

Hi,

I am creating a patch for this issue.

Please review the patch.

Let me know for any suggestions.

Thanks.

Pooja Ganjage’s picture

Status: Active » Needs review
alexpott’s picture

Status: Needs review » Needs work

@Pooja Ganjage what needs to happen here is all of the follow coding removed...

        if (isset($service['autowiring_types'])) {
            if (is_string($service['autowiring_types'])) {
                $definition->addAutowiringType($service['autowiring_types']);
            } else {
                if (!is_array($service['autowiring_types'])) {
                    throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
                }

                foreach ($service['autowiring_types'] as $autowiringType) {
                    if (!is_string($autowiringType)) {
                        throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file));
                    }

                    $definition->addAutowiringType($autowiringType);
                }
            }
        }

It is completely broken in Drupal 9 as $definition->addAutowiringType() does not exist.

anmolgoyal74’s picture

Issue summary: View changes
StatusFileSize
new1.44 KB
new1.52 KB
anmolgoyal74’s picture

Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

The patch looks great, this is the only mention of this feature in core. However, this is also the only place the word "autowiring" appears and so it should be removed from core/misc/cspell/dictionary.txt as part of this patch.

Once this is done this can be marked RTBC.

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new1.73 KB
new209 bytes

Addressed #14

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!,

alexpott’s picture

Title: Fix Call to deprecated method addAutowiringType() of class Symfony\Component\DependencyInjection\Definition in YamlFileLoader » [backport] Fix Call to deprecated method addAutowiringType() of class Symfony\Component\DependencyInjection\Definition in YamlFileLoader
Version: 9.2.x-dev » 9.1.x-dev
Category: Task » Bug report

This is a bug. If your services.yml had autowiring_types then this code would trigger an error.

Committed 29397a9 and pushed to 9.2.x. Thanks!

Will backport after 9.1.x alpha and discussion with release managers.

  • alexpott committed 29397a9 on 9.2.x
    Issue #3069026 by anmolgoyal74, Pooja Ganjage, mikelutz, longwave,...
alexpott’s picture

Version: 9.1.x-dev » 9.0.x-dev
Status: Reviewed & tested by the community » Fixed

Backported to 9.0.x because this is dead broken code.

  • alexpott committed 60d6a2d on 9.1.x
    Issue #3069026 by anmolgoyal74, Pooja Ganjage, mikelutz, longwave,...

  • alexpott committed 224ac3c on 9.0.x
    Issue #3069026 by anmolgoyal74, Pooja Ganjage, mikelutz, longwave,...
alexpott’s picture

Title: [backport] Fix Call to deprecated method addAutowiringType() of class Symfony\Component\DependencyInjection\Definition in YamlFileLoader » Fix Call to deprecated method addAutowiringType() of class Symfony\Component\DependencyInjection\Definition in YamlFileLoader

Status: Fixed » Closed (fixed)

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