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

Polyfilled interface not aliased #965

Closed
theofidry opened this issue Apr 8, 2024 · 1 comment · Fixed by #966
Closed

Polyfilled interface not aliased #965

theofidry opened this issue Apr 8, 2024 · 1 comment · Fixed by #966
Milestone

Comments

@theofidry
Copy link
Member

theofidry commented Apr 8, 2024

Bug report

Question Answer
PHP-Scoper version x.y.z <!-- (php-scoper.phar -V or `composer show
PHP version x.y.z
Platform with version e.g. Ubuntu/Windows/MacOS
Github Repo -

This is the scoped code from symfony/polyfill-php80:

<?php

namespace _PHPStan_64f6b4b37;

if (\PHP_VERSION_ID < 80000) {
    interface Stringable
    {
        /**
         * @return string
         */
        public function __toString();
    }
}

We do have the following statement in the autoloader:

humbug_phpscoper_expose_class('Stringable', '_PHPStan_64f6b4b37\Stringable');

But since there is no class_alias() statement it does nothing.

The same problem will happen with:

<?php

namespace _PHPStan_64f6b4b37;

if (\PHP_VERSION_ID < 80000) {
    class ValueError extends \Error
    {
    }
}
@theofidry
Copy link
Member Author

As show in #966, the issue is with class_alias() in nested statements. Excluded symbols are otherwise already aliased.

theofidry added a commit that referenced this issue Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant