Skip to content

Commit 60e38c0

Browse files
committed
Add stubs for grapheme functions
1 parent 5716b28 commit 60e38c0

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"
@@ -209,36 +210,6 @@ ZEND_BEGIN_ARG_INFO_EX(decomposition_args, 0, 0, 1)
209210
ZEND_END_ARG_INFO();
210211
#endif
211212

212-
ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
213-
ZEND_ARG_INFO(0, string)
214-
ZEND_END_ARG_INFO()
215-
216-
ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
217-
ZEND_ARG_INFO(0, haystack)
218-
ZEND_ARG_INFO(0, needle)
219-
ZEND_ARG_INFO(0, offset)
220-
ZEND_END_ARG_INFO()
221-
222-
ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
223-
ZEND_ARG_INFO(0, string)
224-
ZEND_ARG_INFO(0, start)
225-
ZEND_ARG_INFO(0, length)
226-
ZEND_END_ARG_INFO()
227-
228-
ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
229-
ZEND_ARG_INFO(0, haystack)
230-
ZEND_ARG_INFO(0, needle)
231-
ZEND_ARG_INFO(0, before_needle)
232-
ZEND_END_ARG_INFO()
233-
234-
ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
235-
ZEND_ARG_INFO(0, arg1)
236-
ZEND_ARG_INFO(0, arg2)
237-
ZEND_ARG_INFO(0, arg3)
238-
ZEND_ARG_INFO(0, arg4)
239-
ZEND_ARG_INFO(1, arg5) /* 1 = pass by reference */
240-
ZEND_END_ARG_INFO()
241-
242213
ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
243214
ZEND_ARG_INFO(0, formatter)
244215
ZEND_ARG_INFO(0, string)
@@ -662,15 +633,15 @@ static const zend_function_entry intl_functions[] = {
662633
PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
663634

664635
/* grapheme functions */
665-
PHP_FE( grapheme_strlen, grapheme_1_arg )
666-
PHP_FE( grapheme_strpos, grapheme_search_args )
667-
PHP_FE( grapheme_stripos, grapheme_search_args )
668-
PHP_FE( grapheme_strrpos, grapheme_search_args )
669-
PHP_FE( grapheme_strripos, grapheme_search_args )
670-
PHP_FE( grapheme_substr, grapheme_substr_args )
671-
PHP_FE( grapheme_strstr, grapheme_strstr_args )
672-
PHP_FE( grapheme_stristr, grapheme_strstr_args )
673-
PHP_FE( grapheme_extract, grapheme_extract_args )
636+
PHP_FE( grapheme_strlen, arginfo_grapheme_strlen )
637+
PHP_FE( grapheme_strpos, arginfo_grapheme_strpos )
638+
PHP_FE( grapheme_stripos, arginfo_grapheme_stripos )
639+
PHP_FE( grapheme_strrpos, arginfo_grapheme_strrpos )
640+
PHP_FE( grapheme_strripos, arginfo_grapheme_strripos )
641+
PHP_FE( grapheme_substr, arginfo_grapheme_substr )
642+
PHP_FE( grapheme_strstr, arginfo_grapheme_strstr )
643+
PHP_FE( grapheme_stristr, arginfo_grapheme_stristr )
644+
PHP_FE( grapheme_extract, arginfo_grapheme_extract )
674645

675646
/* IDN functions */
676647
PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)

0 commit comments

Comments
 (0)