@@ -314,12 +314,12 @@ public static function existsAll($need, $arr, $type = false)
314314 } else {
315315
316316 #以逗号分隔的会被拆开,组成数组
317- if (strpos ($ need , ', ' ) !== false ) {
318- $ need = explode (', ' , $ need );
317+ if (\ strpos ($ need , ', ' ) !== false ) {
318+ $ need = \ explode (', ' , $ need );
319319 self ::existsAll ($ need , $ arr , $ type );
320320 } else {
321321 $ arr = self ::valueToLower ($ arr );//小写
322- $ need = strtolower (trim ($ need ));//小写
322+ $ need = \ strtolower (trim ($ need ));//小写
323323
324324 if (!\in_array ($ need , $ arr , $ type )) {
325325 return $ need ;
@@ -355,7 +355,7 @@ public static function existsOne($need, $arr, $type = false): bool
355355 }
356356
357357 $ arr = self ::changeValueCase ($ arr );//小写
358- $ need = strtolower ($ need );//小写
358+ $ need = \ strtolower ($ need );//小写
359359
360360 if (\in_array ($ need , $ arr , $ type )) {
361361 return true ;
@@ -406,7 +406,9 @@ public static function getByPath($data, string $path, $default = null, string $s
406406 return $ data [$ path ];
407407 }
408408
409- if (!$ nodes = array_filter (explode ($ separator , $ path ))) {
409+ // Error: will clear '0'. eg 'some-key.0'
410+ // if (!$nodes = array_filter(explode($separator, $path))) {
411+ if (!$ nodes = \explode ($ separator , $ path )) {
410412 return $ default ;
411413 }
412414
@@ -486,7 +488,7 @@ public static function collapse($array): array
486488 continue ;
487489 }
488490
489- $ results = array_merge ($ results , $ values );
491+ $ results = \ array_merge ($ results , $ values );
490492 }
491493
492494 return $ results ;
@@ -499,10 +501,10 @@ public static function collapse($array): array
499501 */
500502 public static function crossJoin (...$ arrays ): array
501503 {
502- return array_reduce ($ arrays , function ($ results , $ array ) {
503- return static ::collapse (array_map (function ($ parent ) use ($ array ) {
504- return array_map (function ($ item ) use ($ parent ) {
505- return array_merge ($ parent , [$ item ]);
504+ return \ array_reduce ($ arrays , function ($ results , $ array ) {
505+ return static ::collapse (\ array_map (function ($ parent ) use ($ array ) {
506+ return \ array_map (function ($ item ) use ($ parent ) {
507+ return \ array_merge ($ parent , [$ item ]);
506508 }, $ array );
507509 }, $ results ));
508510 }, [[]]);
@@ -530,7 +532,7 @@ public static function dot($array, $prepend = ''): array
530532
531533 foreach ($ array as $ key => $ value ) {
532534 if (\is_array ($ value ) && !empty ($ value )) {
533- $ results = array_merge ($ results , static ::dot ($ value , $ prepend . $ key . '. ' ));
535+ $ results = \ array_merge ($ results , static ::dot ($ value , $ prepend . $ key . '. ' ));
534536 } else {
535537 $ results [$ prepend . $ key ] = $ value ;
536538 }
@@ -677,7 +679,7 @@ public static function flatten($array, $depth = INF): array
677679 * @param array|string $keys
678680 * @return void
679681 */
680- public static function forget (&$ array , $ keys ): void
682+ public static function forget (&$ array , $ keys )
681683 {
682684 $ original = &$ array ;
683685 $ keys = (array )$ keys ;
0 commit comments