-
Notifications
You must be signed in to change notification settings - Fork 73
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
From Twitter: "Cannot use 'Parent' as class name as it is reserved" when running on < PHP 8.0 code #333
Comments
@Wirone do you have some source codebase (or code snippet) where this happens, perhaps? |
PHP 7.4.6 (lowest I have atm) throws fatal error:
All supported versions yield the same result: https://3v4l.org/11OAR Without additional information I reckon it's "cannot reproduce". |
@Ocramius sorry for being late but I tweeted to you from mobile and for few hours I did not use computer. Here's reproducer: {
"name": "maglnet/composer-require-checker-reproducer",
"description": "Reproducer for \"Cannot use 'Parent' as class name as it is reserved\"",
"type": "project",
"require": {
"quickbooks/v3-php-sdk": "^6.0"
},
"minimum-stability": "stable"
} Running
Tested on PHP 7.4 and 8.1 (both with CRC 3.8.0). |
Running
That's nothing we can change since PHP 7.x defines the reserved keyword There are "test" files placed under "src" and therefore these are parsed by composer-require-checker. There is currently no way to exclude paths in vendors from parsing. And there should not be given the fact that the internal structure of a dependency is nothing the using project should care about. In the dependency itself it might be possible to exclude the tests via @Ocramius Do you have pleas for having a configurable blacklist of paths in vendor not to consider while analysing a project? It would solve the actual problem without interacting with upstream but would open up a whole new category of issues "why is the symbol not found, it's clearly defined -- because the file defining the symbol has been blacklisted" - and the blacklist if using patterns might interfere with dependency updates ... headache included IMHO. |
Oh, wow, that QuickBooks stuff includes a whole test suite (and foreign libraries) under its My suggestion is to report an upstream bug: this stuff should at least be in their Other folks seem to have similar problems with it: |
I think configuration is not the problem here: the tool is highlighting a problem, which is real (and part of a broken dependency). Adding configuration to shadow/exclude (let's avoid "blacklist") certain paths from a scan is possible in future, but it's not at the core of the problem here. |
@dkreuer @Ocramius thanks for taking your time on it and your suggestions. Looking at PR mentioned above I think there's really small chance that |
@Wirone the maintainer of that library ( @abisalehalliprasan ) is mentioned/pinged in this issue :-) |
@Ocramius I think we need to migrate from |
@Ocramius exclude feature to circumvent upstream packages issues? Pro: require checker will be usable in these cases too. Con: More configuration which might go wrong. I’d put that feature on my todo list for OSS work in January if it‘s greenlit. |
Issue and solution is probably a duplicate of #58. and there already was doubt if such an option would be worth it. |
Source:
Going to analyse if it's happening with PHP 7.4.* or only with PHP ^8.0.
The text was updated successfully, but these errors were encountered: