Skip to content

Commit

Permalink
DB facade alias support (#126)
Browse files Browse the repository at this point in the history
* Convert DB facade stub method to static
  • Loading branch information
mzur authored Jul 4, 2021
1 parent da4e6bc commit cf9fbd8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stubs/DBFacade.stubphp
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class DB extends Facade
*
* @psalm-taint-sink sql $value
*/
public function raw($value) {}
}
public static function raw($value) {}
}
31 changes: 31 additions & 0 deletions tests/acceptance/DBFacadeAlias.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Feature: DB facade alias
Want to check that the alias of the DB facade works properly

Background:
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="false">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
</psalm>
"""

Scenario: call the DB facade alias
Given I have the following code
"""
<?php declare(strict_types=1);
namespace Tests\Psalm\LaravelPlugin\Sandbox;
function test(): void {
\DB::raw(1);
}
"""
When I run Psalm
Then I see no errors

0 comments on commit cf9fbd8

Please sign in to comment.