Skip to content

Feature - define arrays in ruleset #1665

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

Merged

Conversation

michalbundyra
Copy link
Contributor

Currently if we want override array property in ruleset we have to do:

<property name="forbiddenFunctions" type="array"
    value="print=>echo,create_function=>null" />

It's fine as long as the array content is short.

With this feature the new method to define arrays in the ruleset is introduced:

<property name="forbiddenFunctions" type="array">
    <element key="print" value="echo"/>
    <element key="create_function" value="null"/>
</property>

@gsherwood
Copy link
Member

A change to the format like this would need to be postponed until a 4.0, but I think it is a good idea.

@michalbundyra
Copy link
Contributor Author

@gsherwood With this PR I have not removed previous version of defining array, both are working fine.
I think then you can release it in 3.x and deprecate old method, and in 4.0 you will just remove old method. What do you think?

@gsherwood
Copy link
Member

I think then you can release it in 3.x and deprecate old method, and in 4.0 you will just remove old method. What do you think?

I would prefer one method and one set of docs for how to use it.

@jrfnl
Copy link
Contributor

jrfnl commented Sep 20, 2017

I think then you can release it in 3.x and deprecate old method, and in 4.0 you will just remove old method.

I would prefer one method and one set of docs for how to use it.

I kind of like the idea of having a change-over period available for such a big change in how array property values are passed (even if the new method would not be documented in the wiki until the 4.x release).

@michalbundyra michalbundyra force-pushed the feature/ruleset-array-property branch from 01ad4b6 to 6d5f875 Compare March 25, 2018 14:49
@michalbundyra
Copy link
Contributor Author

@gsherwood Any chance to have it in 3.x release? This PR just add new ability to define array values which is more clear. I see similar change has been made in 3.x release with "@codingstandards" comments - deprecated old notation and introduced the new one.

@gsherwood gsherwood added this to the 3.3.0 milestone Mar 25, 2018
@gsherwood gsherwood merged commit 6d5f875 into squizlabs:master Apr 4, 2018
@gsherwood
Copy link
Member

This has now been merged in and will be in 3.3.0. The old syntax is now deprecated and will be removed in version 4. Docs were updated.

Thanks for this PR - it's a much better syntax. I did change the way the debug info prints though because a print_r() broke the formatting.

@michalbundyra michalbundyra deleted the feature/ruleset-array-property branch April 4, 2018 06:34
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.

3 participants