mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2025-01-22 21:31:21 +01:00
test: ensure head/last work correctly
This commit is contained in:
parent
997c3e6144
commit
0369da4a30
@ -31,6 +31,38 @@ Feature: helpers
|
||||
When I run Psalm
|
||||
Then I see no errors
|
||||
|
||||
Scenario: head and last support
|
||||
Given I have the following code
|
||||
"""
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
function empty_head()
|
||||
{
|
||||
return head([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
function empty_last()
|
||||
{
|
||||
return last([]);
|
||||
}
|
||||
|
||||
function non_empty_head(): int
|
||||
{
|
||||
return last([1, 2, 3]);
|
||||
}
|
||||
|
||||
function non_empty_last(): int
|
||||
{
|
||||
return last([1, 2, 3]);
|
||||
}
|
||||
"""
|
||||
When I run Psalm
|
||||
Then I see no errors
|
||||
|
||||
Scenario: optional support
|
||||
Given I have the following code
|
||||
"""
|
||||
@ -38,7 +70,6 @@ Feature: helpers
|
||||
{
|
||||
return optional($user)->getMessage();
|
||||
}
|
||||
|
||||
"""
|
||||
When I run Psalm
|
||||
Then I see no errors
|
||||
@ -58,7 +89,6 @@ Feature: helpers
|
||||
{
|
||||
return logger();
|
||||
}
|
||||
|
||||
"""
|
||||
When I run Psalm
|
||||
Then I see no errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user