Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapper::stringToCodeUnits() does not consider "inheritance" between traits #8

Closed
sebastianbergmann opened this issue Dec 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@sebastianbergmann
Copy link
Owner

sebastianbergmann commented Dec 12, 2024

test.php

<?php declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';

use SebastianBergmann\CodeUnit\Mapper;

trait T1
{
    public function one(): void
    {
    }
}

trait T2
{
    use T1;

    public function two(): void
    {
    }
}

class C
{
    use T2;

    public function three(): void
    {
    }
}

$mapper = new Mapper;

foreach ($mapper->stringToCodeUnits(C::class) as $codeUnit) {
    print $codeUnit->name() . PHP_EOL;
}

Actual

C
T2

Expected

C
T2
T1

Originally reported by @InvisibleSmiley in sebastianbergmann/phpunit#6080.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant