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

✨ New PSR4PathsTrait #346

Merged
merged 1 commit into from
Nov 20, 2023
Merged

✨ New PSR4PathsTrait #346

merged 1 commit into from
Nov 20, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Nov 20, 2023

This commit introduces a new PSR4PathsTrait to add a custom $psr4_paths property to sniffs.

The value expected by the $psr4_paths property mirrors the autoload directive for Composer, with the prefix as the array key and a comma separated list of relative paths as the array value. Multiple PSR-4 paths can be passed (array elements).

Includes utility functions to validate the property value, to verify if an arbitrary file is in one of the PSR4 paths and to retrieve the matched PSR-4 path information.

Includes dedicated unit tests for this trait.

This commit introduces a new `PSR4PathsTrait` to add a custom `$psr4_paths` property to sniffs.

The value expected by the `$psr4_paths` property mirrors the `autoload` directive for Composer, with the prefix as the array key and a comma separated list of relative paths as the array value.
Multiple PSR-4 paths can be passed (array elements).

Includes utility functions to validate the property value, to verify if an arbitrary file is in one of the PSR4 paths and to retrieve the matched PSR-4 path information.

Includes dedicated unit tests for this trait.
@coveralls
Copy link

Coverage Status

coverage: 99.323% (+0.03%) from 99.294%
when pulling 0fa3146 on JRF/new-psr4pathstrait
into 9d4841e on develop.

@jrfnl jrfnl merged commit 0d870dc into develop Nov 20, 2023
25 checks passed
@jrfnl jrfnl deleted the JRF/new-psr4pathstrait branch November 20, 2023 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants