-
-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Description
I have a little wrapper class for PDO queries that basically boils down to this:
<?php
class DB
{
public static function Instance() : \Pdo\Mysql
{
return PDO::connect();
}
/**
* @param literal-string $query
*
* @see \PDO::prepare()
*/
public static function Prepare( string $query ) : \PDOStatement
{
return self::Instance()->prepare( $query );
}
/**
* @param literal-string $query
*
* @see \PDO::query()
*/
public static function Query( string $query ) : \PDOStatement
{
return self::Instance()->query( $query );
}
}I tried the following config:
services:
-
class: staabm\PHPStanDba\Rules\SyntaxErrorInQueryMethodRule
tags: [phpstan.rules.rule]
arguments:
classMethods:
- 'DB::Query#0'
- 'DB::Prepare#0'
-
class: staabm\PHPStanDba\Rules\QueryPlanAnalyzerRule
tags: [phpstan.rules.rule]
arguments:
classMethods:
- 'DB::Query#0'
- 'DB::Prepare#0'But after looking at these rules, they only implement MethodCall, while I believe static methods would be StaticCall, unfortunately SyntaxErrorInQueryFunctionRule also does not work for this.
Is the solution here to add a 3rd rule to handle static calls, and then another if check in QueryPlanAnalyzerRule?
Metadata
Metadata
Assignees
Labels
No labels