Skip to content

Commit 3d19b89

Browse files
florianschaefer-jbisfedorov
authored andcommitted
Force array_first/-last input types through template
1 parent d74d654 commit 3d19b89

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

meta/.phpstorm.meta.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ function sql_injection_subst($argNum) {
6767
override(\array_reduce(0), type(2));
6868
override(\array_slice(0), type(0));
6969
override(\array_diff(0), type(0));
70+
override(\array_first(0), elementType(0));
71+
override(\array_last(0), elementType(0));
7072
override(\array_diff_assoc(0), type(0));
7173
override(\array_diff_uassoc(0), type(0));
7274
override(\array_diff_key(0), type(0));

standard/standard_8.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,11 +1110,21 @@ function array_merge(
11101110
): array {}
11111111

11121112
/**
1113+
* @template TKey
1114+
* @template TValue
1115+
* @param array<TKey, TValue> $array
1116+
* @return TValue|null
11131117
* @since 8.5
1118+
* @meta
11141119
*/
11151120
function array_first(array $array): mixed {}
11161121

11171122
/**
1123+
* @template TKey
1124+
* @template TValue
1125+
* @param array<TKey, TValue> $array
1126+
* @return TValue|null
11181127
* @since 8.5
1128+
* @meta
11191129
*/
11201130
function array_last(array $array): mixed {}

0 commit comments

Comments
 (0)