Skip to content

Conversation

crocodele
Copy link
Contributor

Fixes #844.

Running composer dump-autoload --optimize --strict-psr --strict-ambiguous in current master branch yields:

~ composer dump-autoload --optimize --strict-psr --strict-ambiguous
Generating optimized autoload files
Warning: Ambiguous class resolution, "Stringable" was found in both "<path-to-repo>/json-schema/vendor/marc-mabe/php-enum/stubs/Stringable.php" and "<path-to-repo>/json-schema/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php", the first will be used.
To resolve ambiguity in classes not under your control you can ignore them by path using exclude-files-from-classmap
Class Tool\Validator\UriValidatorTest located in ./tests/Tool/Validator/UriValidatorTest.php does not comply with psr-4 autoloading standard (rule: JsonSchema\Tests\ => ./tests). Skipping.
Class Tool\Validator\RelativeReferenceValidatorTest located in ./tests/Tool/Validator/RelativeReferenceValidatorTest.php does not comply with psr-4 autoloading standard (rule: JsonSchema\Tests\ => ./tests). Skipping.
Generated optimized autoload files containing 1845 classes

The namespace of the two test files is addressed as part of this PR.

The \Stringable ambiguity is more problematic. symfony/polyfill-80 is a transitive dev dependency only, so it can be solved by excluding the dev dependencies. Is linting with --no-dev enough? Otherwise using exclude-files-from-classmap is an option.

@DannyvdSluijs
Copy link
Collaborator

@crocodele thanks for the quick PR. Really happy to see your contribution.

The vendor folder doesn’t have to be checked as no composer install is done in this pipeline.

If you could only amend your PR with an entry in the changelog that would be very helpful and I can merge the PR after that.

Thanks again for your work.

@crocodele
Copy link
Contributor Author

If you could only amend your PR with an entry in the changelog that would be very helpful and I can merge the PR after that.

Added a changelog entry in 3b47b76.

@DannyvdSluijs DannyvdSluijs merged commit 1ed7239 into jsonrainbow:master Sep 20, 2025
17 checks passed
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

Successfully merging this pull request may close these issues.

Expand linting workflow to check for PSR-4/PSR-0 autoloading compliance
2 participants