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

How to skip particular file #407

Open
bogdandubyk opened this issue Jun 26, 2023 · 6 comments
Open

How to skip particular file #407

bogdandubyk opened this issue Jun 26, 2023 · 6 comments

Comments

@bogdandubyk
Copy link

I have an issue with doctrine-ODM, particularly with this file https://github.com/doctrine/mongodb-odm/blob/2.6.x/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Match.php , checker failing with an error:

In LocateASTFromFiles.php line 41:
                                                                                                                                                                                                                  
  Parsing the file [/srv/app/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup/Match.php] resulted in an error: Syntax error, unexpected T_MATCH, expecting T_STRING on line 15  
        

and it's because I'm using PHP 8.2 where match is a reserved word, I tried adding a file to a white list like this

  "symbol-whitelist" : [
    "null", "true", "false",
    "static", "self", "parent",
    "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object",
    "Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\GraphLookup\\Match"
  ],

but not sure if I'm doing it correctly or if it's possible at all, but anyway issue is still there. Is there a way to handle this? In general this file is deprecated and my app is working only checker failing

@fredden
Copy link
Contributor

fredden commented Jun 26, 2023

It looks like the PHP requirements in that package are too open. For example, they claim to support PHP 8.4 and 8.9 (neither of which have been released): https://github.com/doctrine/mongodb-odm/blob/2.5.2/composer.json#L24. Getting that fixed should solve this particular problem going forward, as Composer will refuse to install packages which are not compatible with the running (or configured) PHP version.

It seems that you have already reported this problem upstream in doctrine/mongodb-odm#2539. I think the work-around is to use a supported PHP version (which may take some experimentation given the broad claim in their composer.json).

@bogdandubyk
Copy link
Author

thank you @fredden, but still is it very hard to provide some configuration option similar to symbol-whitelist where files that should be skipped can be lister? I'm not asking to introduce this feature right away but can imagine more cases like mine, and it's nice to have the option to ignore some file/path. Something similar implemented by unused checker https://github.com/composer-unused/composer-unused#exclude-folders-and-packages

@Ocramius
Copy link
Collaborator

Ocramius commented Jun 26, 2023 via email

@malarzm
Copy link

malarzm commented Jun 26, 2023

The class that this project is complaining about is deprecated and exists solely for BC reasons: https://github.com/doctrine/mongodb-odm/blob/69e64e7eb51f07bcfc09bc8e7ea8329f301b44ff/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Match.php#L11-L14. Said class is not used from within the ODM and the project works perfectly fine with PHP 8.2

@bogdandubyk
Copy link
Author

yes, I'm on the latest stable version which supports PHP 8.2, all works perfectly, only CI failing because the checker analyzing this deprecated file and failing.

@Ocramius
Copy link
Collaborator

My very simplistic endorsement here would be to make something as simple as rm vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup/Match.php in a pre-tool step 👍

Assuming you don't actually need that file, it's probably best to even drop it from your final build artifact that goes to production, to avoid anything ever touching it :)

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

4 participants