-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Automatic version detection #1098
base: main
Are you sure you want to change the base?
Automatic version detection #1098
Conversation
I've been thinking, this feature I'm proposing could also be implemented as a separate repo/package. If that approach is preferred, I would gladly consent to having it under the same vendor. |
This comment was marked as resolved.
This comment was marked as resolved.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1098 +/- ##
=============================================
- Coverage 100.00% 99.68% -0.32%
- Complexity 70 84 +14
=============================================
Files 22 23 +1
Lines 11310 11352 +42
=============================================
+ Hits 11310 11316 +6
- Misses 0 36 +36 ☔ View full report in Codecov by Sentry. |
Thank you for your pull request, @uuf6429! This project solves to issues for me:
Why would you want to automatically select a different configuration depending on the PHP version you are currently running in? |
If I had multiple projects in different PHP versions, it would be nice to define a custom configuration that applies to all projects without worrying that some particular setting will break in a specific version. For example, say I have a custom config to enable short-array-syntax (PHP 5.4+) and space-around-concatenation, I wouldn't want to manually check for the PHP version if I happen to use it on PHP 5.3. Anyway, this feature wasn't taken favourably at work...apparently we're fine reinventing our own version of a wheel, so feel free to close this PR if you see no value. |
This pull request adds a new ruleset,
PhpAuto
, that picks the right ruleset based on the minimum required PHP version defined incomposer.json
of the current working directory.New dependencies added:
ext-json
(backword compatible, since it was already required by php-cs-fixer)composer/semver
(supported since PHP 5.3, so it should also be fine)Additional Changes:
Design Notes:
PHP version -> ruleset class
(e.g.[53 => Php53::class]
) map but then I thought it would be less work to just add an interface and build the class name dynamically