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

Attempted to load class \"LNumber\" ... #999

Closed
jorismak opened this issue May 14, 2024 · 1 comment
Closed

Attempted to load class \"LNumber\" ... #999

jorismak opened this issue May 14, 2024 · 1 comment

Comments

@jorismak
Copy link

I'll throw a bit of the stack-trace here, but it's truncated at the bottom.

This only happens when the project is installed with composer -o -a (as I do in a deployment / testing pipeline). If you leave out the -a it works fine.

PHP 8.3
Nikic/php-parser 5.02 is installed in my project.

{
    "title": "An error occurred",
    "detail": "Attempted to load class \"LNumber\" from namespace \"PhpParser\\Node\\Scalar\".\nDid you forget a \"use\" statement for \"PhpParser\\Node\\Scalar\\LNumber\"?",
    "status": 500,
    "type": "/errors/500",
    "trace": [
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Generator/CreateTargetStatementsGenerator.php",
            "line": 137,
            "function": "constructorArgument",
            "class": "AutoMapper\\Generator\\CreateTargetStatementsGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Generator/CreateTargetStatementsGenerator.php",
            "line": 64,
            "function": "constructorArguments",
            "class": "AutoMapper\\Generator\\CreateTargetStatementsGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Generator/MapMethodStatementsGenerator.php",
            "line": 54,
            "function": "generate",
            "class": "AutoMapper\\Generator\\CreateTargetStatementsGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Generator/MapperGenerator.php",
            "line": 118,
            "function": "getStatements",
            "class": "AutoMapper\\Generator\\MapMethodStatementsGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Generator/MapperGenerator.php",
            "line": 74,
            "function": "mapMethod",
            "class": "AutoMapper\\Generator\\MapperGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Loader/FileLoader.php",
            "line": 82,
            "function": "generate",
            "class": "AutoMapper\\Generator\\MapperGenerator",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/Loader/FileLoader.php",
            "line": 58,
            "function": "createGeneratedMapper",
            "class": "AutoMapper\\Loader\\FileLoader",
            "type": "->"
        },
        {
            "file": "/home/joris/projects/sena-portal-backend/vendor/jolicode/automapper/src/AutoMapper.php",
            "line": 72,
            "function": "loadClass",
            "class": "AutoMapper\\Loader\\FileLoader",
            "type": "->"
        },
symfony composer why nikic/php-parser

jolicode/automapper       9.0.1   requires nikic/php-parser (^4.18 || ^5.0)
phpunit/php-code-coverage 11.0.3  requires nikic/php-parser (^5.0)
sebastian/complexity      4.0.0   requires nikic/php-parser (^5.0)
sebastian/lines-of-code   3.0.0   requires nikic/php-parser (^5.0)
symfony/maker-bundle      v1.59.1 requires nikic/php-parser (^4.18|^5.0)

From what I can see, php-parser adds an alias...

// @deprecated compatibility alias
class_alias(Int_::class, LNumber::class);

...which is apparently optimized out by composer -o -a.

Is LNumber / DNumber deprecated in php-parser?

@nikic
Copy link
Owner

nikic commented May 15, 2024

Is LNumber / DNumber deprecated in php-parser?

As the comment above that line says, yes :)

I don't think there is anything I can do about this, if -a drops the class_alias calls that are needed for compatibility with the old names...

@nikic nikic closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants