Skip to content

Commit

Permalink
Extract Doctrine\DBAL\SQLParserUtilsException::missingType()
Browse files Browse the repository at this point in the history
  • Loading branch information
Majkl578 committed May 12, 2018
1 parent ff42c36 commit c936977
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
17 changes: 17 additions & 0 deletions lib/Doctrine/DBAL/Exception/MissingSQLType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Exception;

use Doctrine\DBAL\SQLParserUtilsException;

final class MissingSQLType extends SQLParserUtilsException
{
public static function new(string $typeName) : self
{
return new self(
sprintf('Value for :%1$s not found in types array. Types array key should be "%1$s"', $typeName)
);
}
}
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/SQLParserUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\DBAL;

use Doctrine\DBAL\Exception\MissingSQLParam;
use Doctrine\DBAL\Exception\MissingSQLType;
use const PREG_OFFSET_CAPTURE;
use function array_fill;
use function array_key_exists;
Expand Down Expand Up @@ -240,6 +241,6 @@ private static function extractParam($paramName, $paramsOrTypes, $isParam, $defa
throw MissingSQLParam::new($paramName);
}

throw SQLParserUtilsException::missingType($paramName);
throw MissingSQLType::new($paramName);
}
}
9 changes: 0 additions & 9 deletions lib/Doctrine/DBAL/SQLParserUtilsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@
*/
class SQLParserUtilsException extends DBALException
{
/**
* @param string $typeName
*
* @return \Doctrine\DBAL\SQLParserUtilsException
*/
public static function missingType($typeName)
{
return new self(sprintf('Value for :%1$s not found in types array. Types array key should be "%1$s"', $typeName));
}
}

0 comments on commit c936977

Please sign in to comment.