Skip to content

Fatal error: Uncaught Error: Interface 'Stringable' not found in #1010

Open
@reinos

Description

@reinos

Bug report

Question Answer
PHP-Scoper version master branch due to this possible fix
PHP version 8.2
Platform with version MacOS

After running php-scoper it seems that some interfaces are no scoped.

See the source of file /vendor/symfony/polyfill-php80/PhpToken.php

namespace Symfony\Polyfill\Php80;

class PhpToken implements \Stringable
{
....
}

and file vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php

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

are scoped like

namespace ReinosMapsScoped\Symfony\Polyfill\Php80;

class PhpToken implements \Stringable <!-- NOTICE THIS, its not scoped
{
...
}
if (\PHP_VERSION_ID < 80000) {
    interface Stringable
    {
        /**
         * @return string
         */
        public function __toString();
    }
    \class_alias('ReinosMapsScoped\\Stringable', 'Stringable', \false);
}

The issue seems that class PhpToken implements \Stringable is not scoped to class PhpToken implements \ ReinosMapsScoped\Stringable

Now it throws an PHP error Fatal error: Uncaught Error: Interface 'Stringable' not found in..... and with adding manually the scoped namespace it fixed the error.

Is this a bug in PHPscoper or a configuration issue? 🤔

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions