Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 1 addition & 241 deletions .phpstan-dba-mysqli.cache

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .phpstan-dba-pdo-mysql.cache

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/Rules/QueryPlanAnalyzerRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ReflectionProvider;
Expand All @@ -30,7 +33,7 @@ final class QueryPlanAnalyzerRule implements Rule
/**
* @var list<string>
*/
private array $classMethods;
public array $classMethods;

private ReflectionProvider $reflectionProvider;

Expand All @@ -56,6 +59,15 @@ public function processNode(Node $callLike, Scope $scope): array
}

$methodReflection = $scope->getMethodReflection($scope->getType($callLike->var), $callLike->name->toString());
} elseif ($callLike instanceof StaticCall) {
if (! $callLike->name instanceof Identifier) {
return [];
}
if (! $callLike->class instanceof Name) {
return [];
}
$classType = $scope->resolveTypeByName($callLike->class);
$methodReflection = $scope->getMethodReflection($classType, $callLike->name->toString());
} elseif ($callLike instanceof New_) {
if (! $callLike->class instanceof FullyQualified) {
return [];
Expand Down Expand Up @@ -105,7 +117,7 @@ public function processNode(Node $callLike, Scope $scope): array
}

/**
* @param MethodCall|New_ $callLike
* @param MethodCall|StaticCall|New_ $callLike
*
* @return list<IdentifierRuleError>
*/
Expand Down
14 changes: 13 additions & 1 deletion src/Rules/SyntaxErrorInPreparedStatementMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ReflectionProvider;
Expand Down Expand Up @@ -57,6 +60,15 @@ public function processNode(Node $callLike, Scope $scope): array
}

$methodReflection = $scope->getMethodReflection($scope->getType($callLike->var), $callLike->name->toString());
} elseif ($callLike instanceof StaticCall) {
if (! $callLike->name instanceof Identifier) {
return [];
}
if (! $callLike->class instanceof Name) {
return [];
}
$classType = $scope->resolveTypeByName($callLike->class);
$methodReflection = $scope->getMethodReflection($classType, $callLike->name->toString());
} elseif ($callLike instanceof New_) {
if (! $callLike->class instanceof FullyQualified) {
return [];
Expand Down Expand Up @@ -96,7 +108,7 @@ public function processNode(Node $callLike, Scope $scope): array
}

/**
* @param MethodCall|New_ $callLike
* @param MethodCall|StaticCall|New_ $callLike
*
* @return list<IdentifierRuleError>
*/
Expand Down
Loading