Skip to content

Commit

Permalink
Whitespace CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danack committed Jun 15, 2021
1 parent ed784bc commit 80fc1a7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 111 deletions.
22 changes: 11 additions & 11 deletions Imagick.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function compareImageLayers(int $metric): Imagick {}

public function pingImageBlob(string $image): bool {}

public function pingImageFile(resource $filehandle, ?string $filename=null): bool {}
public function pingImageFile(resource $filehandle, ?string $filename = null): bool {}

public function transposeImage(): bool {}

Expand Down Expand Up @@ -195,9 +195,9 @@ public function getImageProfiles(string $pattern = "*", bool $include_values = t
// DISTORTION_*
public function distortImage(int $distortion, array $arguments, bool $bestfit): bool {}

public function writeImageFile(resource $filehandle, ?string $format=null): bool {}
public function writeImageFile(resource $filehandle, ?string $format = null): bool {}

public function writeImagesFile(resource $filehandle, ?string $format=null): bool {}
public function writeImagesFile(resource $filehandle, ?string $format = null): bool {}

public function resetImagePage(string $page): bool {}

Expand Down Expand Up @@ -435,7 +435,7 @@ public function smushImages(bool $stack, int $offset): Imagick {}

// PHP_ME(imagick, __construct, imagick_construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
// TODO int|float? :spocks_eyebrow.gif:
public function __construct(string|array|int|float|null $files=null) {}
public function __construct(string|array|int|float|null $files = null) {}

public function __toString(): string {}

Expand All @@ -456,13 +456,13 @@ public function readImage(string $filename): bool {}

public function readImages(array $filenames): bool {}

public function readImageBlob(string $image, ?string $filename=null): bool {}
public function readImageBlob(string $image, ?string $filename = null): bool {}

public function setImageFormat(string $format): bool {}

public function scaleImage(int $columns, int $rows, bool $bestfit = false, bool $legacy = false): bool {}

public function writeImage(?string $filename=null): bool {}
public function writeImage(?string $filename = null): bool {}

public function writeImages(string $filename, bool $adjoin): bool {}

Expand Down Expand Up @@ -710,7 +710,7 @@ public static function queryFormats(string $pattern = "*"): array {}
public static function queryFonts(string $pattern = "*"): array {}

/* TODO $multiline == null, means we should autodetect */
public function queryFontMetrics(ImagickDraw $settings, string $text, ?bool $multiline=null): array {}
public function queryFontMetrics(ImagickDraw $settings, string $text, ?bool $multiline = null): array {}

public function steganoImage(Imagick $watermark, int $offset): Imagick {}

Expand Down Expand Up @@ -1127,7 +1127,7 @@ public function newImage(
int $columns,
int $rows,
ImagickPixel|string $background_color,
string $format=null
string $format = null
): bool {}

// TODO - canvas? description
Expand All @@ -1139,7 +1139,7 @@ public function getCompressionQuality(): int {}

public static function getCopyright(): string {}

public static function getConfigureOptions(string $pattern="*"): string {}
public static function getConfigureOptions(string $pattern = "*"): string {}


#if MagickLibVersion > 0x660
Expand Down Expand Up @@ -1266,10 +1266,10 @@ 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 {}
public function subimageMatch(Imagick $image, ?array &$offset = null, ?float &$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 {}
public function similarityimage(imagick $image, ?array &$offset = null, ?float &$similarity = null, float $threshold = 0.0, int $metric = 0): Imagick {}
#endif

public static function setRegistry(string $key, string $value): bool {}
Expand Down
126 changes: 26 additions & 100 deletions Imagick_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_pingImageFile, 0, 0, 1)
ZEND_ARG_INFO(0, filehandle)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")

This comment has been minimized.

Copy link
@remicollet

remicollet Jun 15, 2021

Contributor

Have you re-regenerate this header without adding the conditional part

This comment has been minimized.

Copy link
@Danack

Danack Jun 15, 2021

Author Collaborator

It's been regenerated, yes:

/* This is a generated file, edit the .stub.php file instead.

  • Stub hash: regen with 'sh regen_arginfo.sh'
  • file has been fixedup for different versions */

Presumably that's causing a problem?

This comment has been minimized.

Copy link
@remicollet

remicollet Jun 15, 2021

Contributor

ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE is PHP 8 only ;)

BTW... not using the upstream way seems ugly, and hard to maintain.

Problem is that @generate-legacy-arginfo will remove all type hinting in PHP 7 which were present in previous versions...

This comment has been minimized.

Copy link
@Danack

Danack Jun 15, 2021

Author Collaborator

Moderately surprising it doesn't seem to error then.....which probably needs investigating....or just kicking the CI which seems flaky today.

I'll add another hack to fixup_arginfo.php later.

This comment has been minimized.

Copy link
@remicollet

remicollet Jun 15, 2021

Contributor

See pr #423 for discussion

ZEND_END_ARG_INFO()
#endif

Expand Down Expand Up @@ -827,12 +822,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_writeImageFile, 0, 0, 1)
ZEND_ARG_INFO(0, filehandle)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, format)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#endif

Expand Down Expand Up @@ -1679,13 +1669,7 @@ ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick___construct, 0, 0, 0)

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_MASK(0, files, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_NULL, "null")
#else
ZEND_ARG_INFO(0, files)
#endif

ZEND_ARG_TYPE_MASK(0, files, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_NULL, "null")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -1805,12 +1789,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_readImageBlob, 0, 0, 1)
#else
ZEND_ARG_INFO(0, image)
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -1858,12 +1837,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_writeImage, 0, 0,
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_writeImage, 0, 0, 0)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
#else
ZEND_ARG_INFO(0, filename)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filename, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -1906,12 +1880,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_blurImage, 0, 0, 2)
#else
ZEND_ARG_INFO(0, sigma)
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, channel, IS_LONG, 0, "Imagick::CHANNEL_DEFAULT")
#else
ZEND_ARG_INFO(0, channel)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, channel, IS_LONG, 0, "Imagick::CHANNEL_DEFAULT")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -2913,27 +2882,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_setImageUnits, 0, 0, 1)
#endif
ZEND_END_ARG_INFO()


#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_sharpenImage, 0, 2, _IS_BOOL, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_sharpenImage, 0, 0, 2)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, radius, IS_DOUBLE, 0)
#else
ZEND_ARG_INFO(0, radius)
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, sigma, IS_DOUBLE, 0)
#else
ZEND_ARG_INFO(0, sigma)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, channel, IS_LONG, 0, "Imagick::CHANNEL_DEFAULT")
ZEND_END_ARG_INFO()
#define arginfo_class_Imagick_sharpenImage arginfo_class_Imagick_blurImage

#define arginfo_class_Imagick_shaveImage arginfo_class_Imagick_sampleImage

Expand Down Expand Up @@ -3042,12 +2991,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_queryFontMetrics, 0, 0, 2)
#else
ZEND_ARG_INFO(0, text)
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, multiline, _IS_BOOL, 1, "null")
#else
ZEND_ARG_INFO(0, multiline)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, multiline, _IS_BOOL, 1, "null")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -3540,7 +3484,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_gammaImage, 0, 0, 1)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, channel, IS_LONG, 0, "Imagick::CHANNEL_DEFAULT")
ZEND_END_ARG_INFO()

#define arginfo_class_Imagick_gaussianBlurImage arginfo_class_Imagick_sharpenImage
#define arginfo_class_Imagick_gaussianBlurImage arginfo_class_Imagick_blurImage

#if MagickLibVersion < 0x700 && !defined(MAGICKCORE_EXCLUDE_DEPRECATED)

Expand Down Expand Up @@ -4468,12 +4412,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_newImage, 0, 0, 3)
ZEND_ARG_INFO(0, rows)
#endif
ZEND_ARG_OBJ_TYPE_MASK(0, background_color, ImagickPixel, MAY_BE_STRING, NULL)

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 0, "null")
#else
ZEND_ARG_INFO(0, format)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 0, "null")
ZEND_END_ARG_INFO()


Expand Down Expand Up @@ -4516,12 +4455,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_getConfigureOption
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_getConfigureOptions, 0, 0, 0)
#endif


#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "*")
#else
ZEND_ARG_INFO(0, pattern)
#endif
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"*\"")
ZEND_END_ARG_INFO()

#if MagickLibVersion > 0x660
Expand Down Expand Up @@ -4835,35 +4769,27 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_subimageMatch, 0, 0, 1)
#endif

ZEND_ARG_OBJ_INFO(0, image, Imagick, 0)

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

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, similarity, IS_DOUBLE, 1, "0.0")
#else
ZEND_ARG_INFO(1, similarity)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, offset, IS_ARRAY, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, similarity, IS_DOUBLE, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, threshold, IS_DOUBLE, 0, "0.0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, metric, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#endif

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, threshold, IS_DOUBLE, 0, "0.0")
#else
ZEND_ARG_INFO(1, threshold)
#endif
#if MagickLibVersion > 0x628 && MagickLibVersion >= 0x652

#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, metric, IS_LONG, 0, "0")
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Imagick_similarityimage, 0, 1, Imagick, 0)
#else
ZEND_ARG_INFO(1, metric)
#endif
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_similarityimage, 0, 0, 1)
#endif

#if MagickLibVersion > 0x628 && MagickLibVersion >= 0x652
#define arginfo_class_Imagick_similarityimage arginfo_class_Imagick_subimageMatch
ZEND_ARG_OBJ_INFO(0, image, imagick, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, offset, IS_ARRAY, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(1, similarity, IS_DOUBLE, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, threshold, IS_DOUBLE, 0, "0.0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, metric, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
#endif

#if MagickLibVersion > 0x628
Expand Down Expand Up @@ -6485,4 +6411,4 @@ static const zend_function_entry class_Imagick_methods[] = {
ZEND_ME(Imagick, setImageMask, arginfo_class_Imagick_setImageMask, ZEND_ACC_PUBLIC)
#endif
ZEND_FE_END
};
};

0 comments on commit 80fc1a7

Please sign in to comment.