Skip to content

Commit

Permalink
fix for PHP 8.1.0beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jul 21, 2021
1 parent 93b1994 commit 28508a8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
12 changes: 8 additions & 4 deletions Imagick.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,11 +1223,15 @@ public function key(): int {}
//# endif
//#endif

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

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

public function valid(): bool {}

Expand Down
14 changes: 9 additions & 5 deletions ImagickPixelIterator.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ public function getPreviousIteratorRow(): array {}
/** @alias ImagickPixelIterator::getIteratorRow */
public function key(): int {}

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

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

/** @alias ImagickPixelIterator::getCurrentIteratorRow */
public function current(): array {}
Expand All @@ -59,4 +63,4 @@ public function setIteratorRow(int $row): bool {}
public function syncIterator(): bool {}

public function valid(): bool {}
}
}
5 changes: 3 additions & 2 deletions ImagickPixelIterator_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ ZEND_END_ARG_INFO()

#define arginfo_class_ImagickPixelIterator_key arginfo_class_ImagickPixelIterator_getIteratorRow

#define arginfo_class_ImagickPixelIterator_next arginfo_class_ImagickPixelIterator_getCurrentIteratorRow
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_next, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()

#define arginfo_class_ImagickPixelIterator_rewind arginfo_class_ImagickPixelIterator_clear
#define arginfo_class_ImagickPixelIterator_rewind arginfo_class_ImagickPixelIterator_next

#define arginfo_class_ImagickPixelIterator_current arginfo_class_ImagickPixelIterator_getCurrentIteratorRow

Expand Down
5 changes: 3 additions & 2 deletions Imagick_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -4786,11 +4786,12 @@ ZEND_END_ARG_INFO()
#endif

#if MagickLibVersion > 0x628
#define arginfo_class_Imagick_next arginfo_class_Imagick_optimizeImageLayers
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_next, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
#endif

#if MagickLibVersion > 0x628
#define arginfo_class_Imagick_rewind arginfo_class_Imagick_optimizeImageLayers
#define arginfo_class_Imagick_rewind arginfo_class_Imagick_next
#endif

#if MagickLibVersion > 0x628
Expand Down
4 changes: 2 additions & 2 deletions regen_arginfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

VER=0$(php-config --vernum 2>/dev/null)

if [ $VER -lt 70100 ]; then
if [ $VER -lt 80100 ]; then

echo "You need php >= 7.1 to run this script"
echo "You need php >= 8.1 to run this script"

elif [ ! -f build/gen_stub.php ]; then

Expand Down
7 changes: 6 additions & 1 deletion shim_php7_to_php8.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@


#if PHP_VERSION_ID < 80100
#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
#endif

#if PHP_VERSION_ID < 80000
// Allow the generated stubs to work on previous versions of PHP

Expand All @@ -11,4 +16,4 @@

#define MAY_BE_STRING ""

#endif
#endif

0 comments on commit 28508a8

Please sign in to comment.