Skip to content

Commit

Permalink
fix PHPStan-found bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Feb 8, 2025
1 parent e7f5ddc commit afaa91a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Collection/DbalCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Nextras\Orm\Collection\Helpers\DbalQueryBuilderHelper;
use Nextras\Orm\Collection\Helpers\FetchPairsHelper;
use Nextras\Orm\Entity\IEntity;
use Nextras\Orm\Exception\InvalidStateException;
use Nextras\Orm\Exception\MemberAccessException;
use Nextras\Orm\Exception\NoResultException;
use Nextras\Orm\Mapper\Dbal\DbalMapper;
Expand Down Expand Up @@ -369,7 +370,8 @@ protected function getIteratorCount(): int
$sql = 'SELECT COUNT(*) AS count FROM (' . $builder->getQuerySql() . ') temp';
$args = $builder->getQueryParameters();

$this->resultCount = $this->connection->queryArgs($sql, $args)->fetchField();
$this->resultCount = $this->connection->queryArgs($sql, $args)->fetchField()
?? throw new InvalidStateException("Unable to fetch collection count.");
}

return $this->resultCount;
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/Reflection/ModifierParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function matchModifiers(string $input): array


/**
* @param ReflectionClass<object> $reflectionClass
* @param ReflectionClass<covariant object> $reflectionClass
* @return array{string, array<int|string, mixed>}
* @throws InvalidModifierDefinitionException
*/
Expand Down Expand Up @@ -76,7 +76,7 @@ private function processName(TokenStream $iterator): string


/**
* @param ReflectionClass<object> $reflectionClass
* @param ReflectionClass<covariant object> $reflectionClass
* @return array<int|string, mixed>
*/
private function processArgs(

Check failure on line 82 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 82 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 82 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.
Expand Down Expand Up @@ -154,7 +154,7 @@ private function processArgs(


/**
* @param ReflectionClass<object> $reflectionClass
* @param ReflectionClass<covariant object> $reflectionClass
*/
private function processValue(Token $token, ReflectionClass $reflectionClass): mixed

Check failure on line 159 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 159 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 159 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.
{
Expand All @@ -169,7 +169,7 @@ private function processValue(Token $token, ReflectionClass $reflectionClass): m


/**
* @param ReflectionClass<object> $reflectionClass
* @param ReflectionClass<covariant object> $reflectionClass
*/
private function processKeyword(string $value, ReflectionClass $reflectionClass): mixed

Check failure on line 174 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 174 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.

Check failure on line 174 in src/Entity/Reflection/ModifierParser.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3)

Call-site variance of covariant object in generic type ReflectionClass<covariant object> in PHPDoc tag @param for parameter $reflectionClass is redundant, template type T of object of class ReflectionClass has the same variance.
{
Expand Down

0 comments on commit afaa91a

Please sign in to comment.