File tree Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 11
11
12
12
strategy :
13
13
matrix :
14
- # operating-system: [ubuntu-latest, windows-latest, macos-latest]
15
- operating-system : [ubuntu-latest, macos-latest]
14
+ operating-system : [ubuntu-latest, windows-latest, macos-latest]
16
15
php-versions : ['7.2', '7.3', '7.4']
17
16
runs-on : ${{ matrix.operating-system }}
18
17
Original file line number Diff line number Diff line change @@ -112,22 +112,31 @@ public static function makePattern(
112
112
*/
113
113
public static function makeArrayOutput (array $ entries ): string
114
114
{
115
- $ output = '' ;
116
- foreach ( $ entries as $ key => $ value ) {
117
- $ output .= <<<EOT
118
- [ { $ key} ] => { $ value}
119
-
120
- EOT ;
121
- }
122
- $ output = rtrim ( $ output );
123
-
124
- return <<<EOT
115
+ $ output = preg_replace ( ' /\R/ ' , "\n" , str_replace (
116
+ ' {{entries}} ' ,
117
+ implode ( PHP_EOL , array_map (
118
+ function ( $ key, $ value): string {
119
+ return " [ { $ key } ] => { $ value }" ;
120
+ },
121
+ array_keys ( $ entries ),
122
+ array_values ( $ entries )
123
+ )),
124
+ <<<' EOT'
125
125
Array
126
126
(
127
- {$ output }
127
+ {{entries} }
128
128
)
129
129
130
- EOT ;
130
+ EOT
131
+ ));
132
+
133
+ if ($ output === null ) {
134
+ throw new \UnexpectedValueException (
135
+ 'Error while replacing newlines in array output '
136
+ );
137
+ }
138
+
139
+ return $ output ;
131
140
}
132
141
133
142
/**
You can’t perform that action at this time.
0 commit comments