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

Is it possible to have different configuration values for different files? #2699

Closed
benignant opened this issue Nov 17, 2019 · 3 comments
Closed

Comments

@benignant
Copy link

I'm using PHPCompatibility and I'd like to have different configuration values for different files.

For some files I want the following configuration:

<config name="testVersion" value="5.5-"/>

And for other files:

<config name="testVersion" value="5.2-"/>

I'd like to do this from my phpcs.xml file. Is this possible?

@jrfnl
Copy link
Contributor

jrfnl commented Nov 17, 2019

Have a look at #1821 and the follow-up #2197.

@gsherwood
Copy link
Member

I don't think the issue is that the config value is being overridden. It sounds like @benignant wants to have some files checked as PHP 5.5 and some as PHP 5.2.

This is not possible within a ruleset.xml file. The value you define there is set before the run begins, then that value is used throughout the run.

If you want to apply different values to different files or directories, you'd need to do 2 different runs and so have 2 different rulesets - one for PHP 5.5 and one for 5.2.

Unless PHPCompatibility has a specific feature for this. You could ask over there to be sure, but I don't think a core PHPCS feature is going to help you here.

@benignant
Copy link
Author

Got it, thanks. I'm using some editor tooling which automatically runs phpcs with my phpcs.xml file, so this solution won't work for that. But at least this will work with a Composer script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants