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

Dev: Remove the image ignore errors in phpstan-baseline.php #7765

Merged
merged 5 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
80 changes: 0 additions & 80 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1366,71 +1366,6 @@
'count' => 1,
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forEXIFUnsupported\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forFileNotSupported\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forImageProcessFailed\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidDirection\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageCreate\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageLibraryPath\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidPath\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingAngle\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingImage\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forSaveFailed\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:_text\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:reproportion\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#',
'count' => 1,
Expand All @@ -1441,21 +1376,6 @@
'count' => 2,
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:_text\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:supportedFormatCheck\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc type string\\|null of property CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:\\$resource is not covariant with PHPDoc type resource\\|null of overridden property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$resource\\.$#',
'count' => 1,
Expand Down
20 changes: 10 additions & 10 deletions system/Images/Exceptions/ImageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,52 @@

class ImageException extends FrameworkException implements ExceptionInterface
{
public static function forMissingImage()
public static function forMissingImage(): ImageException
{
return new static(lang('Images.sourceImageRequired'));
}

public static function forFileNotSupported()
public static function forFileNotSupported(): ImageException
{
return new static(lang('Images.fileNotSupported'));
}

public static function forMissingAngle()
public static function forMissingAngle(): ImageException
{
return new static(lang('Images.rotationAngleRequired'));
}

public static function forInvalidDirection(?string $dir = null)
public static function forInvalidDirection(?string $dir = null): ImageException
{
return new static(lang('Images.invalidDirection', [$dir]));
}

public static function forInvalidPath()
public static function forInvalidPath(): ImageException
{
return new static(lang('Images.invalidPath'));
}

public static function forEXIFUnsupported()
public static function forEXIFUnsupported(): ImageException
{
return new static(lang('Images.exifNotSupported'));
}

public static function forInvalidImageCreate(?string $extra = null)
public static function forInvalidImageCreate(?string $extra = null): ImageException
{
return new static(lang('Images.unsupportedImageCreate') . ' ' . $extra);
}

public static function forSaveFailed()
public static function forSaveFailed(): ImageException
{
return new static(lang('Images.saveFailed'));
}

public static function forInvalidImageLibraryPath(?string $path = null)
public static function forInvalidImageLibraryPath(?string $path = null): ImageException
{
return new static(lang('Images.libPathInvalid', [$path]));
}

public static function forImageProcessFailed()
public static function forImageProcessFailed(): ImageException
{
return new static(lang('Images.imageProcessFailed'));
}
Expand Down
6 changes: 6 additions & 0 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ public function withFile(string $path)

/**
* Make the image resource object if needed
*
* @return void
*/
abstract protected function ensureResource();

Expand Down Expand Up @@ -422,6 +424,8 @@ public function text(string $text, array $options = [])

/**
* Handler-specific method for overlaying text on an image.
*
* @return void
*/
abstract protected function _text(string $text, array $options = []);

Expand Down Expand Up @@ -722,6 +726,8 @@ public function __call(string $name, array $args = [])
*
* This function lets us re-proportion the width/height
* if users choose to maintain the aspect ratio when resizing.
*
* @return void
*/
protected function reproportion()
{
Expand Down
6 changes: 6 additions & 0 deletions system/Images/Handlers/ImageMagickHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ protected function getResourcePath()
/**
* Make the image resource object if needed
*
* @return void
*
* @throws Exception
*/
protected function ensureResource()
Expand All @@ -302,6 +304,8 @@ protected function ensureResource()
/**
* Check if given image format is supported
*
* @return void
*
* @throws ImageException
*/
protected function supportedFormatCheck()
Expand All @@ -318,6 +322,8 @@ protected function supportedFormatCheck()
/**
* Handler-specific method for overlaying text on an image.
*
* @return void
*
* @throws Exception
*/
protected function _text(string $text, array $options = [])
Expand Down