Skip to content

Commit

Permalink
Merge pull request #1 from remicollet/issue-php83
Browse files Browse the repository at this point in the history
Issue php83
  • Loading branch information
phpclub authored Aug 6, 2024
2 parents 28f2704 + 9df9261 commit da3b656
Show file tree
Hide file tree
Showing 24 changed files with 1,741 additions and 2,074 deletions.
50 changes: 28 additions & 22 deletions Imagick.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Imagick
{
#if MagickLibVersion > 0x628
public function optimizeImageLayers(): bool {}
public function optimizeImageLayers(): Imagick {}

// METRIC_*
public function compareImageLayers(int $metric): Imagick {}
Expand Down Expand Up @@ -498,15 +498,15 @@ public function clone(): Imagick {}

public function getImageSize(): int {}

public function getImageBlob(): string {}
public function getImageBlob(): ?string {}

public function getImagesBlob(): string {}

public function setFirstIterator(): bool {}

public function setLastIterator(): bool {}

public function resetIterator(): void {}
public function resetIterator(): bool {}

public function previousImage(): bool {}

Expand Down Expand Up @@ -809,8 +809,12 @@ public function contrastImage(bool $sharpen): bool {}

public function combineImages(int $colorspace): Imagick {}

#if MagickLibVersion >= 0x700
public function convolveImage(ImagickKernel $kernel, int $channel = Imagick::CHANNEL_DEFAULT): bool {}
#else
// kernel is a 2d array of float values
public function convolveImage(array $kernel, int $channel = Imagick::CHANNEL_DEFAULT): bool {}
#endif

public function cycleColormapImage(int $displace): bool {}

Expand All @@ -834,7 +838,7 @@ public function evaluateImage(int $evaluate, float $constant, int $channel = Ima
//http://www.imagemagick.org/Usage/layers/#evaluate-sequence

// EVALUATE_*
public function evaluateImages(int $evaluate): bool {}
public function evaluateImages(int $evaluate): Imagick {}

#endif

Expand Down Expand Up @@ -1220,7 +1224,7 @@ public static function getReleaseDate(): string {}

public static function getResource(int $type): int {}

public static function getResourceLimit(int $type): int {}
public static function getResourceLimit(int $type): float {}

public function getSamplingFactors(): array {}

Expand Down Expand Up @@ -1271,14 +1275,8 @@ public function key(): int {}
//# endif
#endif

/** @alias Imagick::nextImage
* @tentative-return-type
*/
public function next(): void {}

/** @alias Imagick::setFirstIterator
* @tentative-return-type
*/
public function rewind(): void {}

public function valid(): bool {}
Expand Down Expand Up @@ -1318,15 +1316,23 @@ public function statisticImage(
#endif

#if MagickLibVersion >= 0x652
public function subimageMatch(Imagick $image, ?array &$offset = null, ?float &$similarity = null, float $threshold = 0.0, int $metric = 0): Imagick {}
/**
* @param array $offset
* @param float $similarity
*/
public function subimageMatch(Imagick $image, &$offset = null, &$similarity = null, float $threshold = 0.0, int $metric = 0): Imagick {}

/** @alias Imagick::subimageMatch */
public function similarityImage(Imagick $image, ?array &$offset = null, ?float &$similarity = null, float $threshold = 0.0, int $metric = 0): Imagick {}
/**
* @alias Imagick::subimageMatch
* @param array $offset
* @param float $similarity
*/
public function similarityImage(Imagick $image, &$offset = null, &$similarity = null, float $threshold = 0.0, int $metric = 0): Imagick {}
#endif

public static function setRegistry(string $key, string $value): bool {}

public static function getRegistry(string $key): string {}
public static function getRegistry(string $key): false|string {}

public static function listRegistry(): array {}

Expand All @@ -1347,7 +1353,7 @@ public function filter(ImagickKernel $kernel, int $channel = Imagick::CHANNEL_UN
#endif
#endif

public function setAntialias(bool $antialias): void {}
public function setAntialias(bool $antialias): bool {}

public function getAntialias(): bool {}

Expand All @@ -1372,26 +1378,26 @@ public function colorDecisionListImage(string $color_correction_collection): boo
#endif

#if MagickLibVersion >= 0x687
public function optimizeImageTransparency(): void {}
public function optimizeImageTransparency(): bool {}
#endif

#if MagickLibVersion >= 0x660
public function autoGammaImage(?int $channel = Imagick::CHANNEL_ALL): void {}
public function autoGammaImage(?int $channel = Imagick::CHANNEL_ALL): bool {}
#endif

#if MagickLibVersion >= 0x692
public function autoOrient(): void {}
public function autoOrient(): bool {}

/** @alias Imagick::autoOrient */
public function autoOrientate(): void {}
public function autoOrientate(): bool {}

// COMPOSITE_*
public function compositeImageGravity(Imagick $image, int $composite_constant, int $gravity): bool {}

#endif

#if MagickLibVersion >= 0x693
public function localContrastImage(float $radius, float $strength): void {}
public function localContrastImage(float $radius, float $strength): bool {}
#endif

#if MagickLibVersion >= 0x700
Expand All @@ -1405,7 +1411,7 @@ public function identifyImageType(): int {}
public function getImageMask(int $pixelmask): ?Imagick {}

// PIXELMASK_*
public function setImageMask(Imagick $clip_mask, int $pixelmask): void {}
public function setImageMask(Imagick $clip_mask, int $pixelmask): bool {}
#endif


Expand Down
4 changes: 2 additions & 2 deletions ImagickDraw.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function point(float $x, float $y): bool {}

public function getTextDecoration(): int {}

public function getTextEncoding(): string {}
public function getTextEncoding(): false|string {}

public function getFontStretch(): int {}

Expand Down Expand Up @@ -180,7 +180,7 @@ public function color(float $x, float $y, int $paint): bool {}

public function comment(string $comment): bool {}

public function getClipPath(): string {}
public function getClipPath(): false|string {}

public function getClipRule(): int {}

Expand Down
11 changes: 9 additions & 2 deletions ImagickDraw_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,14 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ImagickDraw_getTextDecoration arginfo_class_ImagickDraw_getFontStyle

#define arginfo_class_ImagickDraw_getTextEncoding arginfo_class_ImagickDraw_getFont

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_ImagickDraw_getTextEncoding, 0, 0, MAY_BE_FALSE|MAY_BE_STRING)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickDraw_getTextEncoding, 0, 0, 0)
#endif

ZEND_END_ARG_INFO()

#define arginfo_class_ImagickDraw_getFontStretch arginfo_class_ImagickDraw_getFontStyle

Expand Down Expand Up @@ -904,7 +911,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickDraw_comment, 0, 0, 1)
#endif
ZEND_END_ARG_INFO()

#define arginfo_class_ImagickDraw_getClipPath arginfo_class_ImagickDraw_getFont
#define arginfo_class_ImagickDraw_getClipPath arginfo_class_ImagickDraw_getTextEncoding

#define arginfo_class_ImagickDraw_getClipRule arginfo_class_ImagickDraw_getFontStyle

Expand Down
2 changes: 1 addition & 1 deletion ImagickKernel.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function addUnityKernel(float $scale): void {}
// KERNEL_*
public static function fromBuiltin(int $kernel, string $shape): ImagickKernel {}

public static function fromMatrix(array $matrix, ?array $origin): ImagickKernel {}
public static function fromMatrix(array $matrix, array $origin = null): ImagickKernel {}

public function getMatrix(): array {}

Expand Down
9 changes: 5 additions & 4 deletions ImagickKernel_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ ZEND_END_ARG_INFO()
#if defined(IMAGICK_WITH_KERNEL)

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_ImagickKernel_fromMatrix, 0, 2, ImagickKernel, 0)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_ImagickKernel_fromMatrix, 0, 1, ImagickKernel, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickKernel_fromMatrix, 0, 0, 2)
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickKernel_fromMatrix, 0, 0, 1)
#endif


Expand All @@ -68,12 +68,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickKernel_fromMatrix, 0, 0, 2)
#else
ZEND_ARG_INFO(0, matrix)
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, origin, IS_ARRAY, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, origin, IS_ARRAY, 0, "null")
#else
ZEND_ARG_INFO(0, origin)
#endif

ZEND_END_ARG_INFO()
#endif

Expand Down
6 changes: 3 additions & 3 deletions ImagickPixel.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ public function getHSL(): array {}

public function getIndex(): int {}

public function isPixelSimilar(ImagickPixel|string $color, float $fuzz): bool {}
public function isPixelSimilar(ImagickPixel|string $color, float $fuzz): ?bool {}

// The fuzz value should be in the range 0-QuantumRange. The maximum value
// represents the longest possible distance in the colorspace. e.g. from
// RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace
public function isPixelSimilarQuantum(ImagickPixel|string $color, float $fuzz_quantum_range_scaled_by_square_root_of_three): bool {}
public function isPixelSimilarQuantum(ImagickPixel|string $color, float $fuzz_quantum_range_scaled_by_square_root_of_three): ?bool {}

/** @alias ImagickPixel::isPixelSimilarQuantum */

public function isSimilar(
ImagickPixel|string $color,
// Feel free to not use named params for this.
float $fuzz_quantum_range_scaled_by_square_root_of_three
): bool{}
): ?bool{}

public function setColor(string $color): bool {}

Expand Down
12 changes: 3 additions & 9 deletions ImagickPixelIterator.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,23 @@ public static function getPixelRegionIterator(
/** @alias ImagickPixelIterator::clear */
public function destroy(): bool {}

public function getCurrentIteratorRow(): array {}
public function getCurrentIteratorRow(): ?array {}

public function getIteratorRow(): int {}

public function getNextIteratorRow(): array {}
public function getNextIteratorRow(): ?array {}

public function getPreviousIteratorRow(): array {}

/** @alias ImagickPixelIterator::getIteratorRow */
public function key(): int {}

/** @alias ImagickPixelIterator::getNextIteratorRow
* @tentative-return-type
*/
public function next(): void {}

/** @alias ImagickPixelIterator::resetIterator
* @tentative-return-type
*/
public function rewind(): void {}

/** @alias ImagickPixelIterator::getCurrentIteratorRow */
public function current(): array {}
public function current(): ?array {}

public function newPixelIterator(Imagick $imagick): bool {}

Expand Down
27 changes: 21 additions & 6 deletions ImagickPixelIterator_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ZEND_END_ARG_INFO()


#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_getCurrentIteratorRow, 0, 0, IS_ARRAY, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_getCurrentIteratorRow, 0, 0, IS_ARRAY, 1)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixelIterator_getCurrentIteratorRow, 0, 0, 0)
#endif
Expand All @@ -81,11 +81,24 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ImagickPixelIterator_getNextIteratorRow arginfo_class_ImagickPixelIterator_getCurrentIteratorRow

#define arginfo_class_ImagickPixelIterator_getPreviousIteratorRow arginfo_class_ImagickPixelIterator_getCurrentIteratorRow

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_getPreviousIteratorRow, 0, 0, IS_ARRAY, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixelIterator_getPreviousIteratorRow, 0, 0, 0)
#endif

ZEND_END_ARG_INFO()

#define arginfo_class_ImagickPixelIterator_key arginfo_class_ImagickPixelIterator_getIteratorRow

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_next, 0, 0, IS_VOID, 0)

#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_next, 0, 0, IS_VOID, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixelIterator_next, 0, 0, 0)
#endif

ZEND_END_ARG_INFO()

#define arginfo_class_ImagickPixelIterator_rewind arginfo_class_ImagickPixelIterator_next
Expand Down Expand Up @@ -170,9 +183,11 @@ ZEND_METHOD(ImagickPixelIterator, getCurrentIteratorRow);
ZEND_METHOD(ImagickPixelIterator, getIteratorRow);
ZEND_METHOD(ImagickPixelIterator, getNextIteratorRow);
ZEND_METHOD(ImagickPixelIterator, getPreviousIteratorRow);
ZEND_METHOD(ImagickPixelIterator, resetIterator);
ZEND_METHOD(ImagickPixelIterator, next);
ZEND_METHOD(ImagickPixelIterator, rewind);
ZEND_METHOD(ImagickPixelIterator, newPixelIterator);
ZEND_METHOD(ImagickPixelIterator, newPixelRegionIterator);
ZEND_METHOD(ImagickPixelIterator, resetIterator);
ZEND_METHOD(ImagickPixelIterator, setIteratorFirstRow);
ZEND_METHOD(ImagickPixelIterator, setIteratorLastRow);
ZEND_METHOD(ImagickPixelIterator, setIteratorRow);
Expand All @@ -191,8 +206,8 @@ static const zend_function_entry class_ImagickPixelIterator_methods[] = {
ZEND_ME(ImagickPixelIterator, getNextIteratorRow, arginfo_class_ImagickPixelIterator_getNextIteratorRow, ZEND_ACC_PUBLIC)
ZEND_ME(ImagickPixelIterator, getPreviousIteratorRow, arginfo_class_ImagickPixelIterator_getPreviousIteratorRow, ZEND_ACC_PUBLIC)
ZEND_MALIAS(ImagickPixelIterator, key, getIteratorRow, arginfo_class_ImagickPixelIterator_key, ZEND_ACC_PUBLIC)
ZEND_MALIAS(ImagickPixelIterator, next, getNextIteratorRow, arginfo_class_ImagickPixelIterator_next, ZEND_ACC_PUBLIC)
ZEND_MALIAS(ImagickPixelIterator, rewind, resetIterator, arginfo_class_ImagickPixelIterator_rewind, ZEND_ACC_PUBLIC)
ZEND_ME(ImagickPixelIterator, next, arginfo_class_ImagickPixelIterator_next, ZEND_ACC_PUBLIC)
ZEND_ME(ImagickPixelIterator, rewind, arginfo_class_ImagickPixelIterator_rewind, ZEND_ACC_PUBLIC)
ZEND_MALIAS(ImagickPixelIterator, current, getCurrentIteratorRow, arginfo_class_ImagickPixelIterator_current, ZEND_ACC_PUBLIC)
ZEND_ME(ImagickPixelIterator, newPixelIterator, arginfo_class_ImagickPixelIterator_newPixelIterator, ZEND_ACC_PUBLIC)
ZEND_ME(ImagickPixelIterator, newPixelRegionIterator, arginfo_class_ImagickPixelIterator_newPixelRegionIterator, ZEND_ACC_PUBLIC)
Expand Down
4 changes: 2 additions & 2 deletions ImagickPixel_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ZEND_END_ARG_INFO()


#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilar, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilar, 0, 2, _IS_BOOL, 1)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilar, 0, 0, 2)
#endif
Expand All @@ -130,7 +130,7 @@ ZEND_END_ARG_INFO()


#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilarQuantum, 0, 2, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilarQuantum, 0, 2, _IS_BOOL, 1)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ImagickPixel_isPixelSimilarQuantum, 0, 0, 2)
#endif
Expand Down
Loading

0 comments on commit da3b656

Please sign in to comment.