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

Parsing the file [...StateProvider.tpl.php] resulted in an error: Syntax error, unexpected T_NAMESPACE on line 5 #6826

Open
kochen opened this issue Nov 26, 2024 · 3 comments

Comments

@kochen
Copy link

kochen commented Nov 26, 2024

API Platform version(s) affected: since 4.0.4 (4.0.10 still affected)

Description

$ vendor/bin/composer-require-checker
ComposerRequireChecker 4.14.0@b6d5acd89d0de1727c1188157fa99552c39d1dfb
In LocateASTFromFiles.php line 41:
                                                                               
  Parsing the file [.../vendor/api-platform/core/src/Laravel/Console/Maker/Resources/skeleton/StateProvider.tpl.php] resulted in   
  an error: Syntax error, unexpected T_NAMESPACE on line 5                     
                                                                               
In ParserAbstract.php line 321:
                                                  
  Syntax error, unexpected T_NAMESPACE on line 5  
                                                  
check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--output OUTPUT] [--] [<composer-json>]

How to reproduce

Here is a composer.json to reproduce the issue:

{
    "name": "api-platform/issue-2805",
    "type": "project",
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "require-dev": {
        "maglnet/composer-require-checker": "^4.14"
    },
    "require": {
        "api-platform/core": "4.0.10"
    }
}

Possible Solution
Prior to v4.0.4, this would result in a successful check:

$ vendor/bin/composer-require-checker
ComposerRequireChecker 4.14.0@b6d5acd89d0de1727c1188157fa99552c39d1dfb
There were no unknown symbols found.

Additional Context
This is a Symfony project, and not Laravel.

@kochen
Copy link
Author

kochen commented Nov 26, 2024

Moved here from: api-platform/api-platform#2805

@soyuka
Copy link
Member

soyuka commented Dec 1, 2024

you should require api-platform/symfony not api-platform/core.

@kochen
Copy link
Author

kochen commented Dec 1, 2024

you should require api-platform/symfony not api-platform/core.

Thanks for the tip.

This issue & MR are still relevant for those using the Laravel package and a static analysis...

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