Skip to content

False positive with namespace aliasing #51

Open
@alamirault

Description

@alamirault

Hello,

Maybe somebody has an idea in order to avoid this false positive (found by https://github.com/symfony-tools/code-block-checker/blob/main/src/Service/CodeRunner/ClassExist.php)


https://github.com/symfony/symfony-docs/actions/runs/7431226718/job/20221747353?pr=19383

        // src/Entity/Author.php
        namespace App\Entity;

        use Symfony\Component\Validator\Constraints as Assert; # False positive here

        use Symfony\Component\Validator\Mapping\ClassMetadata;

        class Author
        {
            // ...

            public static function loadValidatorMetadata(ClassMetadata $metadata): void
            {
                $metadata->addPropertyConstraint('mac', new Assert\MacAddress());
            }
        }

[Missing class] Class, interface or trait with name "Symfony\Component\Validator\Constraints" does not exist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions