The composer test script runs phpcs, parallel-lint, and minus-x. The first two of these are separate composer scripts.
Running composer phpcs works correctly and runs phpcs on all core PHP files, excluding ^(extensions|skins|cache)/* and ^docs/(coverage|html|js|latex)/*.
However, running composer lint . runs parallel-lint on everything other than node_modules and vendor. It should not be run on extensions or skins (or cache or docs, but I guess those don't often contain php files).
minus-x also runs on everything.