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

make named constructor in Exception classes consistent: use return instead of throw #2809

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions system/Exceptions/CastException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public static function forInvalidJsonFormatException(int $error)
switch($error)
{
case JSON_ERROR_DEPTH:
throw new static(lang('Cast.jsonErrorDepth'));
return new static(lang('Cast.jsonErrorDepth'));
case JSON_ERROR_STATE_MISMATCH:
throw new static(lang('Cast.jsonErrorStateMismatch'));
return new static(lang('Cast.jsonErrorStateMismatch'));
case JSON_ERROR_CTRL_CHAR:
throw new static(lang('Cast.jsonErrorCtrlChar'));
return new static(lang('Cast.jsonErrorCtrlChar'));
case JSON_ERROR_SYNTAX:
throw new static(lang('Cast.jsonErrorSyntax'));
return new static(lang('Cast.jsonErrorSyntax'));
case JSON_ERROR_UTF8:
throw new static(lang('Cast.jsonErrorUtf8'));
return new static(lang('Cast.jsonErrorUtf8'));
default:
throw new static(lang('Cast.jsonErrorUnknown'));
return new static(lang('Cast.jsonErrorUnknown'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion system/Exceptions/ConfigException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class ConfigException extends CriticalError

public static function forDisabledMigrations()
{
throw new static(lang('Migrations.disabled'));
return new static(lang('Migrations.disabled'));
}
}