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

Class scanning order affects constant resolution #2413

Closed
muglug opened this issue Dec 4, 2019 · 0 comments
Closed

Class scanning order affects constant resolution #2413

muglug opened this issue Dec 4, 2019 · 0 comments
Labels

Comments

@muglug
Copy link
Collaborator

muglug commented Dec 4, 2019

<?php
class Mapper {
    public const MAP = [
        Foo::class => self::A,
        Bar::class => self::E,
    ];

    public const A1 = 'A1';

    private const A = [
        self::A1,
    ];

    public const E1 = 'E1';

    private const E = [
        self::E1,
    ];
}

abstract class Base {
    public static function getValidAccountTypes(): array {
        return Mapper::MAP[static::class] ?? [];
    }
}

class Foo extends Base {}
class Bar extends Base {}

Expected: no issue
Actual: return type cannot be inferred

@muglug muglug added the bug label Dec 4, 2019
@muglug muglug closed this as completed in a3e51d6 Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant