Skip to content

Not usable on symfony/validator since syntax is broken on comment containing the word 'namespace' #397

@DevHiNet

Description

@DevHiNet

Tool erronously performs transformation also when the word 'namespace' is present in input files but has no syntactical meaning

Actually Symfony validation library contains a comment with the word 'namespace'
https://github.com/symfony/validator/blob/f7c32e309885a97fc9572335e22c2c2d31f328c4/Mapping/ClassMetadata.php#L114

Original (untrasformed) source code

    [...]
    private \ReflectionClass $reflClass;

    public function __construct(string $class)
    {
        $this->name = $class;
        // class name without namespace
        if (false !== $nsSep = strrpos($class, '\\')) {
            $this->defaultGroup = substr($class, $nsSep + 1);
        } else {
            $this->defaultGroup = $class;
        }
    }

Transformed output (broken) source code

    [...]
    private \ReflectionClass $reflClass;

    public function __construct(string $class)
    {
        $this->name = $class;
        // class name without namespace My\Custom\Wrapper\if (false !== $nsSep = strrpos($class, '\\')) {
            $this->defaultGroup = substr($class, $nsSep + 1);
        } else {
            $this->defaultGroup = $class;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions