Merge pull request #18410 from kamil-tekiela/never-type

Add never type
This commit is contained in:
Maurício Meneghini Fauth 2023-05-12 11:21:49 -03:00 committed by GitHub
commit 77dc78e32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 6 deletions

View File

@ -130,7 +130,7 @@ class Pdf extends TCPDF
* @param string $errorMessage the error message
*/
// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function Error(mixed $errorMessage = ''): void
public function Error(mixed $errorMessage = ''): never
{
echo Message::error(
__('Error while creating PDF:') . ' ' . $errorMessage,

View File

@ -250,7 +250,7 @@ class ExportRelationSchema
* @param string $type Schema Type
* @param string $errorMessage The error message
*/
public static function dieSchema(int $pageNumber, string $type = '', string $errorMessage = ''): void
public static function dieSchema(int $pageNumber, string $type = '', string $errorMessage = ''): never
{
echo '<p><strong>' , __('SCHEMA ERROR: ') , $type , '</strong></p>' , "\n";
if (! empty($errorMessage)) {

View File

@ -368,7 +368,7 @@ class ResponseRenderer
/**
* Sends an HTML response to the browser
*/
public function response(): void
public function response(): never
{
$this->buffer->stop();
if ($this->HTML === '') {

View File

@ -486,7 +486,7 @@ class Sql
* @param string $error error after executing the query
* @param string $fullSqlQuery full sql query
*/
private function handleQueryExecuteError(bool $isGotoFile, string $error, string $fullSqlQuery): void
private function handleQueryExecuteError(bool $isGotoFile, string $error, string $fullSqlQuery): never
{
if ($isGotoFile) {
$message = Message::rawError($error);

View File

@ -12,8 +12,7 @@ use function preg_match;
*/
final class UrlRedirector
{
/** @psalm-return never */
public static function redirect(string $url): void
public static function redirect(string $url): never
{
// Load database service because services.php is not available here
$GLOBALS['dbi'] = DatabaseInterface::load();