mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-16 20:08:41 +00:00
Turn some returns into exceptions
This commit is contained in:
parent
46465207a7
commit
b82213d97f
|
|
@ -95,7 +95,7 @@ abstract class GrammarAbstract
|
|||
{
|
||||
return trim(
|
||||
implode(' ',
|
||||
array_filter(
|
||||
\array_filter(
|
||||
$this->compileComponents($query),
|
||||
function ($value) {
|
||||
return (string) $value !== '';
|
||||
|
|
@ -169,13 +169,13 @@ abstract class GrammarAbstract
|
|||
$expression = '';
|
||||
|
||||
foreach ($elements as $key => $element) {
|
||||
if (is_string($element) && $element !== '*') {
|
||||
if (strpos($element, '.') === false) {
|
||||
if (\is_string($element) && $element !== '*') {
|
||||
if (\strpos($element, '.') === false) {
|
||||
$prefix = '';
|
||||
}
|
||||
|
||||
$expression .= $this->compileSystem($element, $prefix) . ', ';
|
||||
} elseif (is_string($element) && $element === '*') {
|
||||
} elseif (\is_string($element) && $element === '*') {
|
||||
$expression .= '*, ';
|
||||
} elseif ($element instanceof \Closure) {
|
||||
$expression .= $element() . ', ';
|
||||
|
|
@ -204,9 +204,9 @@ abstract class GrammarAbstract
|
|||
$expression = '';
|
||||
|
||||
foreach ($elements as $key => $element) {
|
||||
if (is_string($element) && $element !== '*') {
|
||||
if (\is_string($element) && $element !== '*') {
|
||||
$expression .= $this->compileSystem($element, $prefix) . ', ';
|
||||
} elseif (is_string($element) && $element === '*') {
|
||||
} elseif (\is_string($element) && $element === '*') {
|
||||
$expression .= '*, ';
|
||||
} elseif ($element instanceof \Closure) {
|
||||
$expression .= $element() . ', ';
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ class TableException extends \PDOException
|
|||
|
||||
$table = \substr($message, $pos1 + 1, $pos2 - $pos1 - 1);
|
||||
|
||||
return $table === false ? '' : $table;
|
||||
return $table === false ? $message : $table;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ final class Money implements \Serializable
|
|||
|
||||
$right = \substr($right, 0, self::MAX_DECIMALS);
|
||||
if ($right === false) {
|
||||
return 0;
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
return ((int) $left) * 10 ** self::MAX_DECIMALS + (int) \str_pad($right, self::MAX_DECIMALS, '0');
|
||||
|
|
@ -196,7 +196,7 @@ final class Money implements \Serializable
|
|||
$left = \substr($value, 0, -self::MAX_DECIMALS);
|
||||
$right = \substr($value, -self::MAX_DECIMALS);
|
||||
if ($left === false || $right === false) {
|
||||
return '0';
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
return ($decimals > 0) ? number_format((float) $left, 0, $this->decimal, $this->thousands) . $this->decimal . \substr($right, 0, $decimals) : $left;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ final class Http implements UriInterface
|
|||
$path = \substr($this->path, 0, -4);
|
||||
|
||||
if ($path === false) {
|
||||
return;
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
$this->path = $path;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user