mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
Fix failing tests for firstOrCreate and firstOrNew in Laravel 9
This commit is contained in:
parent
e50f7f0574
commit
48d1c56b46
@ -167,6 +167,20 @@ class Builder
|
|||||||
*/
|
*/
|
||||||
public function firstOr($columns = ['*'], Closure $callback = null) { }
|
public function firstOr($columns = ['*'], Closure $callback = null) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attributes
|
||||||
|
* @param array $values
|
||||||
|
* @return TModel|self<TModel>
|
||||||
|
*/
|
||||||
|
public function firstOrNew(array $attributes = [], array $values = []) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attributes
|
||||||
|
* @param array $values
|
||||||
|
* @return TModel|self<TModel>
|
||||||
|
*/
|
||||||
|
public function firstOrCreate(array $attributes = [], array $values = []) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $column
|
* @param string $column
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
@ -178,7 +178,7 @@ Feature: Eloquent Builder types
|
|||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
|
||||||
Scenario: can call firstOrNew and firstOrCreate without parameters in Laravel 8.x
|
Scenario: can call firstOrNew and firstOrCreate without parameters in Laravel 8.x
|
||||||
Given I have the "laravel/framework" package satisfying the ">= 8.0"
|
Given I have the "laravel/framework" package satisfying the "^8.0"
|
||||||
And I have the following code
|
And I have the following code
|
||||||
"""
|
"""
|
||||||
/**
|
/**
|
||||||
@ -200,6 +200,29 @@ Feature: Eloquent Builder types
|
|||||||
When I run Psalm
|
When I run Psalm
|
||||||
Then I see no errors
|
Then I see no errors
|
||||||
|
|
||||||
|
Scenario: can call firstOrNew and firstOrCreate without parameters in Laravel 9.x
|
||||||
|
Given I have the "laravel/framework" package satisfying the "^9.0"
|
||||||
|
And I have the following code
|
||||||
|
"""
|
||||||
|
/**
|
||||||
|
* @psalm-param Builder<User> $builder
|
||||||
|
* @psalm-return Builder<User>|User
|
||||||
|
*/
|
||||||
|
function test_firstOrCreate(Builder $builder): Builder|User {
|
||||||
|
return $builder->firstOrCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @psalm-param Builder<User> $builder
|
||||||
|
* @psalm-return Builder<User>|User
|
||||||
|
*/
|
||||||
|
function test_firstOrNew(Builder $builder): Builder|User {
|
||||||
|
return $builder->firstOrNew();
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
When I run Psalm
|
||||||
|
Then I see no errors
|
||||||
|
|
||||||
Scenario: can call whereDate with \DateTimeInterface|string|null
|
Scenario: can call whereDate with \DateTimeInterface|string|null
|
||||||
Given I have the following code
|
Given I have the following code
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user