public $classInfos = [];
/** @var bool */
public $generateFunctionEntries = false;
+ /** @var string */
+ public $declarationPrefix = "";
/**
* @return iterable<FuncInfo>
$fileInfo = new FileInfo;
$fileDocComment = getFileDocComment($stmts);
if ($fileDocComment) {
- if (strpos($fileDocComment->getText(), '@generate-function-entries') !== false) {
- $fileInfo->generateFunctionEntries = true;
+ $fileTags = parseDocComment($fileDocComment);
+ foreach ($fileTags as $tag) {
+ if ($tag->name === 'generate-function-entries') {
+ $fileInfo->generateFunctionEntries = true;
+ $fileInfo->declarationPrefix = $tag->value ? $tag->value . " " : "";
+ }
}
}
$generatedFunctionDeclarations = [];
$code .= generateCodeWithConditions(
$fileInfo->getAllFuncInfos(), "",
- function (FuncInfo $funcInfo) use(&$generatedFunctionDeclarations) {
+ function (FuncInfo $funcInfo) use($fileInfo, &$generatedFunctionDeclarations) {
$key = $funcInfo->getDeclarationKey();
if (isset($generatedFunctionDeclarations[$key])) {
return null;
}
$generatedFunctionDeclarations[$key] = true;
-
- return $funcInfo->getDeclaration();
+ return $fileInfo->declarationPrefix . $funcInfo->getDeclaration();
}
);
static zend_class_entry *zend_test_attribute;
static zend_object_handlers zend_test_class_handlers;
-ZEND_FUNCTION(zend_test_func)
+static ZEND_FUNCTION(zend_test_func)
{
RETVAL_STR_COPY(EX(func)->common.function_name);
EX(func) = NULL;
}
-ZEND_FUNCTION(zend_test_array_return)
+static ZEND_FUNCTION(zend_test_array_return)
{
ZEND_PARSE_PARAMETERS_NONE();
}
-ZEND_FUNCTION(zend_test_nullable_array_return)
+static ZEND_FUNCTION(zend_test_nullable_array_return)
{
ZEND_PARSE_PARAMETERS_NONE();
}
-ZEND_FUNCTION(zend_test_void_return)
+static ZEND_FUNCTION(zend_test_void_return)
{
/* dummy */
ZEND_PARSE_PARAMETERS_NONE();
}
-ZEND_FUNCTION(zend_test_deprecated)
+static ZEND_FUNCTION(zend_test_deprecated)
{
zval *arg1;
/* Create a string without terminating null byte. Must be terminated with
* zend_terminate_string() before destruction, otherwise a warning is issued
* in debug builds. */
-ZEND_FUNCTION(zend_create_unterminated_string)
+static ZEND_FUNCTION(zend_create_unterminated_string)
{
zend_string *str, *res;
}
/* Enforce terminate null byte on string. This avoids a warning in debug builds. */
-ZEND_FUNCTION(zend_terminate_string)
+static ZEND_FUNCTION(zend_terminate_string)
{
zend_string *str;
}
/* {{{ Cause an intentional memory leak, for testing/debugging purposes */
-ZEND_FUNCTION(zend_leak_bytes)
+static ZEND_FUNCTION(zend_leak_bytes)
{
zend_long leakbytes = 3;
/* }}} */
/* {{{ Leak a refcounted variable */
-ZEND_FUNCTION(zend_leak_variable)
+static ZEND_FUNCTION(zend_leak_variable)
{
zval *zv;
/* }}} */
/* Tests Z_PARAM_OBJ_OR_STR */
-ZEND_FUNCTION(zend_string_or_object)
+static ZEND_FUNCTION(zend_string_or_object)
{
zend_string *str;
zend_object *object;
/* }}} */
/* Tests Z_PARAM_OBJ_OR_STR_OR_NULL */
-ZEND_FUNCTION(zend_string_or_object_or_null)
+static ZEND_FUNCTION(zend_string_or_object_or_null)
{
zend_string *str;
zend_object *object;
/* }}} */
/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR */
-ZEND_FUNCTION(zend_string_or_stdclass)
+static ZEND_FUNCTION(zend_string_or_stdclass)
{
zend_string *str;
zend_object *object;
/* }}} */
/* Tests Z_PARAM_OBJ_OF_CLASS_OR_STR_OR_NULL */
-ZEND_FUNCTION(zend_string_or_stdclass_or_null)
+static ZEND_FUNCTION(zend_string_or_stdclass_or_null)
{
zend_string *str;
zend_object *object;
/* }}} */
/* TESTS Z_PARAM_ITERABLE and Z_PARAM_ITERABLE_OR_NULL */
-ZEND_FUNCTION(zend_iterable)
+static ZEND_FUNCTION(zend_iterable)
{
zval *arg1, *arg2;
}
}
-ZEND_METHOD(_ZendTestClass, __toString) /* {{{ */ {
+static ZEND_METHOD(_ZendTestClass, __toString) /* {{{ */ {
RETURN_EMPTY_STRING();
}
/* }}} */
/* Internal function returns bool, we return int. */
-ZEND_METHOD(_ZendTestClass, is_object) /* {{{ */ {
+static ZEND_METHOD(_ZendTestClass, is_object) /* {{{ */ {
RETURN_LONG(42);
}
/* }}} */
-ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
+static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
RETURN_TRUE;
}
/* }}} */
<?php
-/** @generate-function-entries */
+/** @generate-function-entries static */
class _ZendTestClass {
public static function is_object(): int {}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 87c9d71b08c538c28b4f9bad01d7a7a3a3b191ef */
+ * Stub hash: 1aa8e876ff9efb99c61603216eed267b0d225221 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_array_return, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_END_ARG_INFO()
-ZEND_FUNCTION(zend_test_array_return);
-ZEND_FUNCTION(zend_test_nullable_array_return);
-ZEND_FUNCTION(zend_test_void_return);
-ZEND_FUNCTION(zend_test_deprecated);
-ZEND_FUNCTION(zend_create_unterminated_string);
-ZEND_FUNCTION(zend_terminate_string);
-ZEND_FUNCTION(zend_leak_variable);
-ZEND_FUNCTION(zend_leak_bytes);
-ZEND_FUNCTION(zend_string_or_object);
-ZEND_FUNCTION(zend_string_or_object_or_null);
-ZEND_FUNCTION(zend_string_or_stdclass);
-ZEND_FUNCTION(zend_string_or_stdclass_or_null);
-ZEND_FUNCTION(zend_iterable);
-ZEND_METHOD(_ZendTestClass, is_object);
-ZEND_METHOD(_ZendTestClass, __toString);
-ZEND_METHOD(_ZendTestTrait, testMethod);
+static ZEND_FUNCTION(zend_test_array_return);
+static ZEND_FUNCTION(zend_test_nullable_array_return);
+static ZEND_FUNCTION(zend_test_void_return);
+static ZEND_FUNCTION(zend_test_deprecated);
+static ZEND_FUNCTION(zend_create_unterminated_string);
+static ZEND_FUNCTION(zend_terminate_string);
+static ZEND_FUNCTION(zend_leak_variable);
+static ZEND_FUNCTION(zend_leak_bytes);
+static ZEND_FUNCTION(zend_string_or_object);
+static ZEND_FUNCTION(zend_string_or_object_or_null);
+static ZEND_FUNCTION(zend_string_or_stdclass);
+static ZEND_FUNCTION(zend_string_or_stdclass_or_null);
+static ZEND_FUNCTION(zend_iterable);
+static ZEND_METHOD(_ZendTestClass, is_object);
+static ZEND_METHOD(_ZendTestClass, __toString);
+static ZEND_METHOD(_ZendTestTrait, testMethod);
static const zend_function_entry ext_functions[] = {