Skip to content

Commit a9e8cd2

Browse files
duncan3dccmb69
authored andcommitted
Convert the example skeleton extension to use arginfo stubs
1 parent 7901913 commit a9e8cd2

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

ext/ext_skel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ function copy_sources() {
330330

331331
$files = [
332332
'skeleton.c' => $options['ext'] . '.c',
333+
'skeleton.stub' => $options['ext'] . '.stub.php',
333334
'php_skeleton.h' => 'php_' . $options['ext'] . '.h'
334335
];
335336

ext/skeleton/skeleton.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "php.h"
88
#include "ext/standard/info.h"
99
#include "php_%EXTNAME%.h"
10+
#include "%EXTNAME%_arginfo.h"
1011

1112
/* For compatibility with older PHP versions */
1213
#ifndef ZEND_PARSE_PARAMETERS_NONE
@@ -66,16 +67,6 @@ PHP_MINFO_FUNCTION(%EXTNAME%)
6667
}
6768
/* }}} */
6869

69-
/* {{{ arginfo
70-
*/
71-
ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test1, 0)
72-
ZEND_END_ARG_INFO()
73-
74-
ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test2, 0)
75-
ZEND_ARG_INFO(0, str)
76-
ZEND_END_ARG_INFO()
77-
/* }}} */
78-
7970
/* {{{ %EXTNAME%_functions[]
8071
*/
8172
static const zend_function_entry %EXTNAME%_functions[] = {

ext/skeleton/skeleton.stub

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
function %EXTNAME%_test1(): void {}
4+
5+
function %EXTNAME%_test2(string $str = ""): string {}

0 commit comments

Comments
 (0)