File tree Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Expand file tree Collapse file tree 5 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 44
55use Safe \Exceptions \ArrayException ;
66
7+ /**
8+ * Creates an array by using the values from the
9+ * keys array as keys and the values from the
10+ * values array as the corresponding values.
11+ *
12+ * @param array $keys Array of keys to be used. Illegal values for key will be
13+ * converted to string.
14+ * @param array $values Array of values to be used
15+ * @return array Returns the combined array, FALSE if the number of elements
16+ * for each array isn't equal.
17+ * @throws ArrayException
18+ *
19+ */
20+ function array_combine (array $ keys , array $ values ): array
21+ {
22+ error_clear_last ();
23+ $ result = \array_combine ($ keys , $ values );
24+ if ($ result === false ) {
25+ throw ArrayException::createFromPhpError ();
26+ }
27+ return $ result ;
28+ }
29+
30+
731/**
832 * array_multisort can be used to sort several
933 * arrays at once, or a multi-dimensional array by one or more
Original file line number Diff line number Diff line change 2525 'apcu_delete ' ,
2626 'apcu_inc ' ,
2727 'apcu_sma_info ' ,
28+ 'array_combine ' ,
2829 'array_multisort ' ,
2930 'array_walk_recursive ' ,
3031 'arsort ' ,
Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ function inet_ntop(string $in_addr): string
389389 *
390390 *
391391 *
392- * You can use one or more of this options. When using multiple options
392+ * You can use one or more of these options. When using multiple options
393393 * you need to OR them, i.e. to open the connection
394394 * immediately, write to the console and include the PID in each message,
395395 * you will use: LOG_CONS | LOG_NDELAY | LOG_PID
Original file line number Diff line number Diff line change @@ -51,6 +51,9 @@ public function detectFalsyFunction(): bool
5151 if (preg_match ('/ or &false; \\(and generates an error/m ' , $ file )) {
5252 return true ;
5353 }
54+ if (preg_match ('/&false;\s+if\s+the\s+number\s+of\s+elements\s+for\s+each\s+array\s+isn \'t\s+equal/m ' , $ file )) {
55+ return true ;
56+ }
5457
5558 return false ;
5659 }
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ services:
2626 apcu_delete : ' Safe\apcu_delete'
2727 apcu_inc : ' Safe\apcu_inc'
2828 apcu_sma_info : ' Safe\apcu_sma_info'
29+ array_combine : ' Safe\array_combine'
2930 array_multisort : ' Safe\array_multisort'
3031 array_walk_recursive : ' Safe\array_walk_recursive'
3132 arsort : ' Safe\arsort'
You can’t perform that action at this time.
0 commit comments