From 7ab196593d4ea7c4d8178221da8aa04d763213e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 22 Jul 2022 10:35:49 +0200 Subject: [PATCH] Declare ext/pspell constants in stubs --- ext/pspell/pspell.c | 8 +++----- ext/pspell/pspell.stub.php | 22 ++++++++++++++++++++-- ext/pspell/pspell_arginfo.h | 10 +++++++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c index 58960e9df56a1..7c15472ed0e6a 100644 --- a/ext/pspell/pspell.c +++ b/ext/pspell/pspell.c @@ -32,7 +32,6 @@ #include "php_pspell.h" #include #include "ext/standard/info.h" -#include "pspell_arginfo.h" #define PSPELL_FAST 1L #define PSPELL_NORMAL 2L @@ -40,6 +39,8 @@ #define PSPELL_SPEED_MASK_INTERNAL 3L #define PSPELL_RUN_TOGETHER 8L +#include "pspell_arginfo.h" + /* Largest ignored word can be 999 characters (this seems sane enough), * and it takes 3 bytes to represent that (see pspell_config_ignore) */ @@ -167,10 +168,7 @@ static PHP_MINIT_FUNCTION(pspell) php_pspell_config_handlers.get_constructor = php_pspell_config_object_get_constructor; php_pspell_config_handlers.offset = XtOffsetOf(php_pspell_config_object, std); - REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS); + register_pspell_symbols(module_number); return SUCCESS; } diff --git a/ext/pspell/pspell.stub.php b/ext/pspell/pspell.stub.php index 3e19e58da8a35..3397edc956e22 100644 --- a/ext/pspell/pspell.stub.php +++ b/ext/pspell/pspell.stub.php @@ -3,7 +3,6 @@ /** @generate-class-entries */ namespace PSpell { - /** * @strict-properties * @not-serializable @@ -15,10 +14,29 @@ final class Dictionary {} * @not-serializable */ final class Config {} - } namespace { + /** + * @var int + * @cvalue PSPELL_FAST + */ + const PSPELL_FAST = UNKNOWN; + /** + * @var int + * @cvalue PSPELL_NORMAL + */ + const PSPELL_NORMAL = UNKNOWN; + /** + * @var int + * @cvalue PSPELL_BAD_SPELLERS + */ + const PSPELL_BAD_SPELLERS = UNKNOWN; + /** + * @var int + * @cvalue PSPELL_RUN_TOGETHER + */ + const PSPELL_RUN_TOGETHER = UNKNOWN; function pspell_new(string $language, string $spelling = "", string $jargon = "", string $encoding = "", int $mode = 0): PSpell\Dictionary|false {} diff --git a/ext/pspell/pspell_arginfo.h b/ext/pspell/pspell_arginfo.h index 59741e2cd07b0..dcbaba9e10c41 100644 --- a/ext/pspell/pspell_arginfo.h +++ b/ext/pspell/pspell_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 54253af8d28520254e062171733c753d7104ec6b */ + * Stub hash: 8d35f61a0b48c5422b31e78f587d9258fd3e8e37 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, PSpell\\Dictionary, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0) @@ -144,6 +144,14 @@ static const zend_function_entry class_PSpell_Config_methods[] = { ZEND_FE_END }; +static void register_pspell_symbols(int module_number) +{ + REGISTER_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_CS | CONST_PERSISTENT); +} + static zend_class_entry *register_class_PSpell_Dictionary(void) { zend_class_entry ce, *class_entry;