NoKeyValue.php 472 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Doctrine\DBAL\Exception;
  3. use Doctrine\DBAL\Exception;
  4. use function sprintf;
  5. /**
  6. * @internal
  7. *
  8. * @psalm-immutable
  9. */
  10. final class NoKeyValue extends Exception
  11. {
  12. public static function fromColumnCount(int $columnCount): self
  13. {
  14. return new self(
  15. sprintf(
  16. 'Fetching as key-value pairs requires the result to contain at least 2 columns, %d given.',
  17. $columnCount
  18. )
  19. );
  20. }
  21. }