Skip to content

Commit

Permalink
Mark all result methods in AbstractQuery as impure
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Dec 2, 2024
1 parent 410ed26 commit 3ae87fc
Showing 1 changed file with 63 additions and 8 deletions.
71 changes: 63 additions & 8 deletions stubs/ORM/AbstractQuery.stub
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace Doctrine\ORM;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;

/**
* @template-covariant TKey The type of column used in indexBy
Expand All @@ -12,21 +13,75 @@ use Doctrine\ORM\NonUniqueResultException;
abstract class AbstractQuery
{

public const HYDRATE_OBJECT = 1;

/**
* @param ArrayCollection<array-key, mixed>|array<mixed> $parameters
* @return static
*/
public function setParameters($parameters)
{

}

/**
* @return bool|float|int|string|null
*
* @throws NoResultException
* @throws NonUniqueResultException
*/
public function getSingleScalarResult();
/**
* @phpstan-impure
* @param string|AbstractQuery::HYDRATE_* $hydrationMode
*/
public function getResult(string|int $hydrationMode = self::HYDRATE_OBJECT): mixed

Check failure on line 30 in stubs/ORM/AbstractQuery.stub

View workflow job for this annotation

GitHub Actions / PHPStan (7.4)

Method Doctrine\ORM\AbstractQuery::getResult() uses native union types but they're supported only on PHP 8.0 and later.
{
}

/**
* @phpstan-impure
* @return mixed[]
*/
public function getArrayResult(): array
{
}

/**
* @phpstan-impure
* @return mixed[]
*/
public function getSingleColumnResult(): array
{
}

/**
* @phpstan-impure
* @return mixed[]
*/
public function getScalarResult(): array
{
}

/**
* @phpstan-impure
* @psalm-param string|AbstractQuery::HYDRATE_*|null $hydrationMode
* @throws NonUniqueResultException
*/
public function getOneOrNullResult(string|int|null $hydrationMode = null): mixed

Check failure on line 63 in stubs/ORM/AbstractQuery.stub

View workflow job for this annotation

GitHub Actions / PHPStan (7.4)

Method Doctrine\ORM\AbstractQuery::getOneOrNullResult() uses native union types but they're supported only on PHP 8.0 and later.
{
}

/**
* @phpstan-impure
* @psalm-param string|AbstractQuery::HYDRATE_*|null $hydrationMode
* @throws NonUniqueResultException
* @throws NoResultException
*/
public function getSingleResult(string|int|null $hydrationMode = null): mixed

Check failure on line 73 in stubs/ORM/AbstractQuery.stub

View workflow job for this annotation

GitHub Actions / PHPStan (7.4)

Method Doctrine\ORM\AbstractQuery::getSingleResult() uses native union types but they're supported only on PHP 8.0 and later.
{
}

/**
* @phpstan-impure
* @return bool|float|int|string|null
* @throws NoResultException
* @throws NonUniqueResultException
*/
public function getSingleScalarResult()
{
}

}

0 comments on commit 3ae87fc

Please sign in to comment.