Skip to content

Commit 4cf4059

Browse files
committed
Add stubs for grapheme functions
1 parent 927dbfe commit 4cf4059

File tree

3 files changed

+77
-39
lines changed

3 files changed

+77
-39
lines changed

ext/intl/grapheme/grapheme.stub.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/** @return int|false|null */
4+
function grapheme_strlen(string $input) {}
5+
6+
/** @return int|false */
7+
function grapheme_strpos(string $haystack, string $needle, int $offset = 0) {}
8+
9+
/** @return int|false */
10+
function grapheme_stripos(string $haystack, string $needle, int $offset = 0) {}
11+
12+
/** @return int|false */
13+
function grapheme_strrpos(string $haystack, string $needle, int $offset = 0) {}
14+
15+
/** @return int|false */
16+
function grapheme_strripos(string $haystack, string $needle, int $offset = 0) {}
17+
18+
/** @return string|false */
19+
function grapheme_substr(string $string, int $start, ?int $length = 0) {}
20+
21+
/** @return string|false */
22+
function grapheme_strstr(string $haystack, string $needle, bool $before_needle = false) {}
23+
24+
/** @return string|false */
25+
function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false) {}
26+
27+
/** @return string|false */
28+
function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null) {}

ext/intl/grapheme/grapheme_arginfo.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strlen, 0, 0, 1)
4+
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
5+
ZEND_END_ARG_INFO()
6+
7+
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strpos, 0, 0, 2)
8+
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
9+
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
10+
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
11+
ZEND_END_ARG_INFO()
12+
13+
#define arginfo_grapheme_stripos arginfo_grapheme_strpos
14+
15+
#define arginfo_grapheme_strrpos arginfo_grapheme_strpos
16+
17+
#define arginfo_grapheme_strripos arginfo_grapheme_strpos
18+
19+
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_substr, 0, 0, 2)
20+
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
21+
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
22+
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
23+
ZEND_END_ARG_INFO()
24+
25+
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strstr, 0, 0, 2)
26+
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
27+
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
28+
ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0)
29+
ZEND_END_ARG_INFO()
30+
31+
#define arginfo_grapheme_stristr arginfo_grapheme_strstr
32+
33+
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_extract, 0, 0, 2)
34+
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
35+
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
36+
ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0)
37+
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
38+
ZEND_ARG_INFO(1, next)
39+
ZEND_END_ARG_INFO()

ext/intl/php_intl.c

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "formatter/formatter_parse.h"
4343

4444
#include "grapheme/grapheme.h"
45+
#include "grapheme/grapheme_arginfo.h"
4546

4647
#include "msgformat/msgformat.h"
4748
#include "msgformat/msgformat_class.h"
@@ -185,36 +186,6 @@ ZEND_BEGIN_ARG_INFO_EX(decomposition_args, 0, 0, 1)
185186
ZEND_END_ARG_INFO();
186187
#endif
187188

188-
ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
189-
ZEND_ARG_INFO(0, string)
190-
ZEND_END_ARG_INFO()
191-
192-
ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
193-
ZEND_ARG_INFO(0, haystack)
194-
ZEND_ARG_INFO(0, needle)
195-
ZEND_ARG_INFO(0, offset)
196-
ZEND_END_ARG_INFO()
197-
198-
ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
199-
ZEND_ARG_INFO(0, string)
200-
ZEND_ARG_INFO(0, start)
201-
ZEND_ARG_INFO(0, length)
202-
ZEND_END_ARG_INFO()
203-
204-
ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
205-
ZEND_ARG_INFO(0, haystack)
206-
ZEND_ARG_INFO(0, needle)
207-
ZEND_ARG_INFO(0, before_needle)
208-
ZEND_END_ARG_INFO()
209-
210-
ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
211-
ZEND_ARG_INFO(0, arg1)
212-
ZEND_ARG_INFO(0, arg2)
213-
ZEND_ARG_INFO(0, arg3)
214-
ZEND_ARG_INFO(0, arg4)
215-
ZEND_ARG_INFO(1, arg5) /* 1 = pass by reference */
216-
ZEND_END_ARG_INFO()
217-
218189
ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
219190
ZEND_ARG_INFO(0, formatter)
220191
ZEND_ARG_INFO(0, string)
@@ -638,15 +609,15 @@ static const zend_function_entry intl_functions[] = {
638609
PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
639610

640611
/* grapheme functions */
641-
PHP_FE( grapheme_strlen, grapheme_1_arg )
642-
PHP_FE( grapheme_strpos, grapheme_search_args )
643-
PHP_FE( grapheme_stripos, grapheme_search_args )
644-
PHP_FE( grapheme_strrpos, grapheme_search_args )
645-
PHP_FE( grapheme_strripos, grapheme_search_args )
646-
PHP_FE( grapheme_substr, grapheme_substr_args )
647-
PHP_FE( grapheme_strstr, grapheme_strstr_args )
648-
PHP_FE( grapheme_stristr, grapheme_strstr_args )
649-
PHP_FE( grapheme_extract, grapheme_extract_args )
612+
PHP_FE( grapheme_strlen, arginfo_grapheme_strlen )
613+
PHP_FE( grapheme_strpos, arginfo_grapheme_strpos )
614+
PHP_FE( grapheme_stripos, arginfo_grapheme_stripos )
615+
PHP_FE( grapheme_strrpos, arginfo_grapheme_strrpos )
616+
PHP_FE( grapheme_strripos, arginfo_grapheme_strripos )
617+
PHP_FE( grapheme_substr, arginfo_grapheme_substr )
618+
PHP_FE( grapheme_strstr, arginfo_grapheme_strstr )
619+
PHP_FE( grapheme_stristr, arginfo_grapheme_stristr )
620+
PHP_FE( grapheme_extract, arginfo_grapheme_extract )
650621

651622
/* IDN functions */
652623
PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)

0 commit comments

Comments
 (0)