Skip to content

Commit

Permalink
refactor: Fix phpstan greaterOrEqual.invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Jan 4, 2025
1 parent db12ec3 commit 6525ed5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 54 deletions.
32 changes: 15 additions & 17 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,23 +396,6 @@ public function flip(string $dir = 'vertical')
*/
abstract protected function _flip(string $direction);

/**
* Overlays a string of text over the image.
*
* Valid options:
*
* - color Text Color (hex number)
* - shadowColor Color of the shadow (hex number)
* - hAlign Horizontal alignment: left, center, right
* - vAlign Vertical alignment: top, middle, bottom
* - hOffset
* - vOffset
* - fontPath
* - fontSize
* - shadowOffset
*
* @return $this
*/
public function text(string $text, array $options = [])
{
$options = array_merge($this->textDefaults, $options);
Expand All @@ -427,6 +410,21 @@ public function text(string $text, array $options = [])
/**
* Handler-specific method for overlaying text on an image.
*
* @param array{
* color?: string,
* shadowColor?: string,
* hAlign?: string,
* vAlign?: string,
* hOffset?: int,
* vOffset?: int,
* fontPath?: string,
* fontSize?: int,
* shadowOffset?: int,
* opacity?: float,
* padding?: int,
* withShadow?: bool|string
* } $options
*
* @return void
*/
abstract protected function _text(string $text, array $options = []);
Expand Down
2 changes: 0 additions & 2 deletions system/Images/Handlers/ImageMagickHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ 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
20 changes: 15 additions & 5 deletions system/Images/ImageHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,21 @@ public function fit(int $width, int $height, string $position);
* - shadowColor Color of the shadow (hex number)
* - hAlign Horizontal alignment: left, center, right
* - vAlign Vertical alignment: top, middle, bottom
* - hOffset
* - vOffset
* - fontPath
* - fontSize
* - shadowOffset
*
* @param array{
* color?: string,
* shadowColor?: string,
* hAlign?: string,
* vAlign?: string,
* hOffset?: int,
* vOffset?: int,
* fontPath?: string,
* fontSize?: int,
* shadowOffset?: int,
* opacity?: float,
* padding?: int,
* withShadow?: bool|string
* } $options
*
* @return $this
*/
Expand Down
8 changes: 0 additions & 8 deletions utils/phpstan-baseline/greaterOrEqual.invalid.neon

This file was deleted.

1 change: 0 additions & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ includes:
- function.inner.neon
- generator.returnType.neon
- generator.valueType.neon
- greaterOrEqual.invalid.neon
- isset.offset.neon
- isset.property.neon
- method.alreadyNarrowedType.neon
Expand Down
22 changes: 1 addition & 21 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1685 errors
# total 1681 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -4687,11 +4687,6 @@ parameters:
count: 1
path: ../../system/Images/Handlers/BaseHandler.php

-
message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:_text\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Images/Handlers/BaseHandler.php

-
message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:calcAspectRatio\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -4702,11 +4697,6 @@ parameters:
count: 1
path: ../../system/Images/Handlers/BaseHandler.php

-
message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:text\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Images/Handlers/BaseHandler.php

-
message: '#^Property CodeIgniter\\Images\\Handlers\\BaseHandler\:\:\$supportTransparency type has no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -4717,11 +4707,6 @@ parameters:
count: 1
path: ../../system/Images/Handlers/BaseHandler.php

-
message: '#^Method CodeIgniter\\Images\\Handlers\\ImageMagickHandler\:\:_text\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Images/Handlers/ImageMagickHandler.php

-
message: '#^Method CodeIgniter\\Images\\Handlers\\ImageMagickHandler\:\:process\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -4732,11 +4717,6 @@ parameters:
count: 1
path: ../../system/Images/Image.php

-
message: '#^Method CodeIgniter\\Images\\ImageHandlerInterface\:\:text\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Images/ImageHandlerInterface.php

-
message: '#^Method CodeIgniter\\Language\\Language\:\:formatMessage\(\) has parameter \$message with no value type specified in iterable type array\.$#'
count: 1
Expand Down

0 comments on commit 6525ed5

Please sign in to comment.