Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark all result methods in AbstractQuery as impure #634

Merged
merged 1 commit into from
Dec 2, 2024
Merged
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
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($hydrationMode = self::HYDRATE_OBJECT): mixed
{
}

/**
* @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
* @param string|AbstractQuery::HYDRATE_*|null $hydrationMode
* @throws NonUniqueResultException
*/
public function getOneOrNullResult($hydrationMode = null): mixed
{
}

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

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

}