ComposerRequireChecker: Error parsing \Doctrine\ODM\MongoDB\Aggregation\Stage\GraphLookup\Match with php8

wrong usage or bug?

is there any way to ignore this file as it is not used in project?

sh-4.2$ php -v
PHP 8.0.7 (cli) (built: Jun 16 2021 12:25:08) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
sh-4.2$ php ${PWD}/composer-require-checker.phar check --ignore-parse-errors --config-file=${PWD}/composer-check-requirements.json ${PWD}/composer.json
ComposerRequireChecker 3.3.0@4063254c611acf34f1c15b29b6bcc47d2e7a9a9e

In LocateASTFromFiles.php line 50:
                                                                                                                                                          
  Parsing the file [${PWD_FOLDER_HERE}/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup/Match.php] resulted in an error.  
//composer-check-requirements.json
{
    "symbol-whitelist": [
        "array",
        "bool",
        "callable",
        "false",
        "fastcgi_finish_request",
        "float",
        "int",
        "iterable",
        "null",
        "object",
        "parent",
        "self",
        "static",
        "string",
        "true",
        "void",
        "last",

        "tideways_xhprof_disable",
        "tideways_xhprof_enable",
        "TIDEWAYS_XHPROF_FLAGS_CPU",
        "TIDEWAYS_XHPROF_FLAGS_MEMORY",

        "Google\\Authenticator\\GoogleAuthenticator"
    ],
    "php-core-extensions": [
        "Core",
        "Phar",
        "Reflection",
        "SPL",
        "date",
        "pcre",
        "standard"
    ],
    "scan-files": [
        //some not related files here
    ]
}
//composer.json
...
    "autoload": {
        "psr-4": {
            "": "src"
        },
        "classmap": [
            // several Kernels here
            "some_dir/Kernel.php",
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Unit\\": "tests/unit",
            "Tests\\Integration\\": "tests/integration",
            "Tests\\Functional\\": "tests/functional",
        }
    }

About this issue

Most upvoted comments

Identify why --ignore-parse-errors didn’t work in this case

This certainly requires investigation, since this is 100% a parse error

Implement a way to exclude some files from scan

Feasible too, but only after having investigated the first bit.

Sorry for the detour around dependency management!

Users would use smth like docker run -v $PWD:/app $repo and maintainers don’t do anything, as dockerhub would update image automatically on tag or master(on your choice)

Problem with that is keeping an updated composer.lock that works for everyone. People running on PHP 7.4 and people running on PHP 8.0 have different requirements (like this bug shows). The combinatory explosion is too much to handle, and it is better to just let people install the set of dependencies that works best for them.

Re-opening as per https://github.com/maglnet/ComposerRequireChecker/issues/283#issuecomment-878965126, since the proposed solution didn’t solve the problem

Also avoid composer global: it’s just trouble.