From 808cb4a6807e1397183d5476b5df1dfd87070ab3 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Fri, 1 Mar 2024 10:29:42 +0100 Subject: [PATCH] Fix broken type annotations (#441) --- phpstan-baseline.neon | 20 -------------------- src/Query/Mysql/Collate.php | 5 +++-- src/Query/MysqlWalker.php | 6 +----- src/Query/Sqlite/Week.php | 3 ++- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6c9c5506..1be4cd71 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Collate\\:\\:\\$collation \\(null\\) does not accept string\\.$#" - count: 1 - path: src/Query/Mysql/Collate.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Collate\\:\\:\\$stringPrimary \\(null\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\.$#" - count: 1 - path: src/Query/Mysql/Collate.php - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$aggregateExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\AggregateExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" count: 1 @@ -49,13 +39,3 @@ parameters: message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Variance\\:\\:\\$arithmeticExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\SimpleArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" count: 1 path: src/Query/Mysql/Variance.php - - - - message: "#^PHPDoc tag @return with type array\\|string is not subtype of native type string\\.$#" - count: 1 - path: src/Query/MysqlWalker.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Sqlite\\\\Week\\:\\:\\$mode \\(int\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Literal\\.$#" - count: 1 - path: src/Query/Sqlite/Week.php diff --git a/src/Query/Mysql/Collate.php b/src/Query/Mysql/Collate.php index 2755ff65..98d485d6 100644 --- a/src/Query/Mysql/Collate.php +++ b/src/Query/Mysql/Collate.php @@ -3,6 +3,7 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; @@ -16,10 +17,10 @@ */ class Collate extends FunctionNode { - /** @var null */ + /** @var Node|null */ public $stringPrimary = null; - /** @var null */ + /** @var string|null */ public $collation = null; public function parse(Parser $parser): void diff --git a/src/Query/MysqlWalker.php b/src/Query/MysqlWalker.php index e7e00933..b144b276 100644 --- a/src/Query/MysqlWalker.php +++ b/src/Query/MysqlWalker.php @@ -8,11 +8,7 @@ class MysqlWalker extends SqlWalker { - /** - * @return array|string - * - * @inheritdoc - */ + /** @inheritdoc */ public function walkSelectClause($selectClause): string { $sql = parent::walkSelectClause($selectClause); diff --git a/src/Query/Sqlite/Week.php b/src/Query/Sqlite/Week.php index a4f77de2..3721ee49 100644 --- a/src/Query/Sqlite/Week.php +++ b/src/Query/Sqlite/Week.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Sqlite; +use Doctrine\ORM\Query\AST\Literal; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\TokenType; @@ -11,7 +12,7 @@ class Week extends NumberFromStrfTime /** * Currently not in use * - * @var int + * @var Literal */ public $mode;