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

Ability to set array values using phpcs:set #1999

Merged

Conversation

michalbundyra
Copy link
Contributor

Property name should be with [] and values must be comma separated.
If we want provide also array keys we need to separate them with =>.
So the format is the same as the one possible format in ruleset, i.e.:

// phpcs:set Squiz.PHP.SniffName property[] key=>value,key2=>value2

@michalbundyra
Copy link
Contributor Author

@gsherwood Any chance to have it merged into 3.3.0 release? I need this to test my custom sniff with array properties. Or maybe there is another way to do it? Thanks!

@michalbundyra
Copy link
Contributor Author

Because of hotfix #2004 probably this is not gonna work to set empty value. Maybe we should allow just:

// phpcs:set Squiz.PHP.SniffName property[]

(so no value provided) and it will mean to set empty value ([])?
Thoughts?

Property name should be with [] and values must be comma separated.
If we want provide also array keys we need to separate them with =>.
So the format is the same as the one possible format in ruleset, i.e.:

// phpcs:set Squiz.PHP.SniffName property[] key=>value,key2=>value2
@michalbundyra
Copy link
Contributor Author

michalbundyra commented Apr 24, 2018

Rebased with base #2004.
Now it is also possible to set empty value for the property - empty array for arrays:

// phpcs:set Squiz.PHP.SniffName property[]

and null for others:

// phpcs:set Squiz.PHP.SniffName property

(so there is no value at all, it means to set empty value).

@gsherwood gsherwood added this to the 3.3.0 milestone May 21, 2018
@gsherwood gsherwood added this to Selected for Development in PHPCS v3 Development May 25, 2018
@gsherwood gsherwood moved this from Selected for Development (v3) to In Progress in PHPCS v3 Development Jun 1, 2018
@gsherwood gsherwood merged commit 7575ad9 into squizlabs:master Jun 1, 2018
PHPCS v3 Development automation moved this from In Progress to Ready for Release Jun 1, 2018
gsherwood added a commit that referenced this pull request Jun 1, 2018
@gsherwood
Copy link
Member

Thanks a lot for this change

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.

None yet

2 participants