Skip to content

[DependcyInjection] _instanceof + PSR4 autoregistration - The definition "..." has a reference to an abstract definition "...". Abstract definitions cannot be the target of references.  #24111

@TomasVotruba

Description

@TomasVotruba
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3

All worked just fine untill I added _instanceof.

I don't understand this message at all. Just need a little guidance.

My setup is following

services:
    _defaults:
        autowire: true

    _instanceof:
        Rector\Rector\AbstractClassAwareRector:
            calls:
                - ['setClassResolver', ['@Rector\NodeAnalyzer\ClassResolver']]

    # PSR-4 autodiscovery
    Rector\:
        resource: '../../src'

And the error:

Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: The definition "Rector\Rector\RectorCollector" has a reference to an abstract definition "abstract.instanceof.Rector\Rector\Contrib\Nette\NetteObjectToSmartTraitRector". Abstract definitions cannot be the target of references. in /var/www/Rector/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php:37

NetteObjectToSmartTraitRector is not an abstract class. Not sure if that's what Symfony thinks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions