mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2025-01-22 21:31:21 +01:00
feature: support head() and last()
This commit is contained in:
parent
0369da4a30
commit
1e7bbf8ee1
@ -81,6 +81,32 @@ class NullObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first element of an array. Useful for method chaining.
|
||||
*
|
||||
* @template TValue
|
||||
* @template TParam of TValue[]
|
||||
* @param TParam $array
|
||||
* @return (TParam is non-empty-array ? TValue : false)
|
||||
*/
|
||||
function head($array)
|
||||
{
|
||||
return reset($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last element from an array.
|
||||
*
|
||||
* @template TValue
|
||||
* @template TParam of TValue[]
|
||||
* @param TParam $array
|
||||
* @return (TParam is non-empty-array ? TValue : false)
|
||||
*/
|
||||
function last($array)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide access to optional objects.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user