Skip to content

class names resolving in use as #128

@zengbo

Description

@zengbo

Version: 4.0.6

Bug Description

When I use a trait method in a class by use as, the trait will use the full name.

Steps To Reproduce

  1. The origin PHP file d.php
<?php

use A\B\C

class D
{
    use C {
       C::abc as acd;
    }
}
  1. Use Phpfile to parse the PHP file and print it
<?php

$php = PhpFile::fromCode(file_get_contents('d.php'));
(new PsrPrinter())->printFile($php);
  1. output:
<?php

use A\B\C

class D
{
    use C {
       \A\B\C::abc as acd;
    }
}

Expected Behavior

<?php

use A\B\C

class D
{
    use C {
       C::abc as acd;
    }
}

Possible Solution

... Only if you have suggestions on a fix for the bug

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