psalm-plugin-laravel/tests/acceptance/DatabaseBuilderTypes.feature
Martin Zurowietz f6193ad5cb Replace deprecated totallyTyped attribute
totallyTyped was deprecated in Psalm v4.21.0 [1].

totallyTyped="true" is equivalent to errorLevel="1" and
totallyTyped="false" is equivalent to errorLevel="2" plus
reportMixedIssues="false" [2].

[1] https://github.com/vimeo/psalm/releases/tag/4.21.0
[2] https://psalm.dev/docs/running_psalm/configuration/#totallytyped
2022-02-21 10:15:13 +01:00

38 lines
1019 B
Gherkin

Feature: Database Builder types
Illuminate\Database\Builder has type support
Background:
Given I have the following config
"""
<?xml version="1.0"?>
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
</psalm>
"""
Scenario: Models can call database query builder instance methods
Given I have the following code
"""
<?php declare(strict_types=1);
use Tests\Psalm\LaravelPlugin\Models\User;
final class UserRepository
{
/**
* @param \Illuminate\Database\Eloquent\Builder<User> $builder
*/
public function firstFromDatabaseBuilderInstance(\Illuminate\Database\Eloquent\Builder $builder): ?User {
return $builder->first();
}
}
"""
When I run Psalm
Then I see no errors