mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
52 lines
1.1 KiB
Gherkin
52 lines
1.1 KiB
Gherkin
Feature: Eloquent Model types
|
|
Illuminate\Database\Eloquent\Model has type support
|
|
|
|
Background:
|
|
Given I have the following config
|
|
"""
|
|
<?xml version="1.0"?>
|
|
<psalm totallyTyped="true">
|
|
<projectFiles>
|
|
<directory name="."/>
|
|
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
|
|
</projectFiles>
|
|
<plugins>
|
|
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
|
|
</plugins>
|
|
</psalm>
|
|
"""
|
|
And I have the following code preamble
|
|
"""
|
|
<?php declare(strict_types=1);
|
|
namespace Tests\Psalm\LaravelPlugin\Sandbox;
|
|
|
|
use Tests\Psalm\LaravelPlugin\Models\User;
|
|
"""
|
|
|
|
Scenario: Model scope support
|
|
Given I have the following code
|
|
"""
|
|
|
|
function test(): \Illuminate\Database\Eloquent\Collection
|
|
{
|
|
return User::active()->get();
|
|
}
|
|
|
|
"""
|
|
When I run Psalm
|
|
Then I see no errors
|
|
|
|
Scenario: find or fail support
|
|
Given I have the following code
|
|
"""
|
|
|
|
function test(): User
|
|
{
|
|
return User::findOrFail(1);
|
|
}
|
|
|
|
"""
|
|
When I run Psalm
|
|
Then I see no errors
|
|
|