@@ -63,46 +63,44 @@ private function extractPatterns(FuncCall $functionCall, Scope $scope): array
63
63
64
64
$ patternStrings = [];
65
65
66
- foreach ( $ patternType -> getConstantStrings () as $ constantStringType ) {
67
- if (
68
- ! in_array ( $ functionName , [
69
- ' preg_match ' ,
70
- ' preg_match_all ' ,
71
- ' preg_split ' ,
72
- ' preg_grep ' ,
73
- ' preg_replace ' ,
74
- ' preg_replace_callback ' ,
75
- ' preg_filter ' ,
76
- ], true )
77
- ) {
78
- continue ;
66
+ if (
67
+ in_array ( $ functionName , [
68
+ ' preg_match ' ,
69
+ ' preg_match_all ' ,
70
+ ' preg_split ' ,
71
+ ' preg_grep ' ,
72
+ ' preg_replace ' ,
73
+ ' preg_replace_callback ' ,
74
+ ' preg_filter ' ,
75
+ ], true )
76
+ ) {
77
+ foreach ( $ patternType -> getConstantStrings () as $ constantStringType ) {
78
+ $ patternStrings [] = $ constantStringType -> getValue () ;
79
79
}
80
-
81
- $ patternStrings [] = $ constantStringType ->getValue ();
82
80
}
83
81
84
- foreach ( $ patternType -> getConstantArrays () as $ constantArrayType ) {
85
- if (
86
- in_array ( $ functionName , [
87
- ' preg_replace ' ,
88
- ' preg_replace_callback ' ,
89
- ' preg_filter ' ,
90
- ], true )
91
- ) {
82
+ if (
83
+ in_array ( $ functionName , [
84
+ ' preg_replace ' ,
85
+ ' preg_replace_callback ' ,
86
+ ' preg_filter ' ,
87
+ ], true )
88
+ ) {
89
+ foreach ( $ patternType -> getConstantArrays () as $ constantArrayType ) {
92
90
foreach ($ constantArrayType ->getValueTypes () as $ arrayKeyType ) {
93
91
foreach ($ arrayKeyType ->getConstantStrings () as $ constantString ) {
94
92
$ patternStrings [] = $ constantString ->getValue ();
95
93
}
96
94
}
97
95
}
96
+ }
98
97
99
- if ($ functionName !== 'preg_replace_callback_array ' ) {
100
- continue ;
101
- }
102
-
103
- foreach ($ constantArrayType ->getKeyTypes () as $ arrayKeyType ) {
104
- foreach ($ arrayKeyType ->getConstantStrings () as $ constantString ) {
105
- $ patternStrings [] = $ constantString ->getValue ();
98
+ if ($ functionName === 'preg_replace_callback_array ' ) {
99
+ foreach ($ patternType ->getConstantArrays () as $ constantArrayType ) {
100
+ foreach ($ constantArrayType ->getKeyTypes () as $ arrayKeyType ) {
101
+ foreach ($ arrayKeyType ->getConstantStrings () as $ constantString ) {
102
+ $ patternStrings [] = $ constantString ->getValue ();
103
+ }
106
104
}
107
105
}
108
106
}
0 commit comments