@@ -945,21 +945,37 @@ private function processRule($rule, $newSniffs, $depth=0)
945
945
if (isset ($ prop ['type ' ]) === true
946
946
&& (string ) $ prop ['type ' ] === 'array '
947
947
) {
948
- $ value = (string ) $ prop ['value ' ];
949
948
$ values = [];
950
- foreach (explode (', ' , $ value ) as $ val ) {
951
- list ($ k , $ v ) = explode ('=> ' , $ val .'=> ' );
952
- if ($ v !== '' ) {
953
- $ values [trim ($ k )] = trim ($ v );
954
- } else {
955
- $ values [] = trim ($ k );
949
+ if (isset ($ prop ->element ) === true ) {
950
+ foreach ($ prop ->element as $ element ) {
951
+ if ($ this ->shouldProcessElement ($ element ) === false ) {
952
+ continue ;
953
+ }
954
+
955
+ $ value = (string ) $ element ['value ' ];
956
+ if (isset ($ element ['key ' ]) === true ) {
957
+ $ key = (string ) $ element ['key ' ];
958
+ $ values [$ key ] = $ value ;
959
+ } else {
960
+ $ values [] = $ value ;
961
+ }
956
962
}
957
- }
963
+ } else {
964
+ $ value = (string ) $ prop ['value ' ];
965
+ foreach (explode (', ' , $ value ) as $ val ) {
966
+ list ($ k , $ v ) = explode ('=> ' , $ val .'=> ' );
967
+ if ($ v !== '' ) {
968
+ $ values [trim ($ k )] = trim ($ v );
969
+ } else {
970
+ $ values [] = trim ($ k );
971
+ }
972
+ }
973
+ }//end if
958
974
959
975
$ this ->ruleset [$ code ]['properties ' ][$ name ] = $ values ;
960
976
if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
961
977
echo str_repeat ("\t" , $ depth );
962
- echo "\t\t=> array property \"$ name \" set to \"$ value \"" ;
978
+ echo "\t\t=> array property \"$ name \" set to \"" . print_r ( $ values , true ). ' " ' ;
963
979
if ($ code !== $ ref ) {
964
980
echo " for $ code " ;
965
981
}
0 commit comments