Skip to content

Commit 31b34a4

Browse files
committed
Add support for retrieving default values of parameters of internal functions
1 parent 4c9699f commit 31b34a4

File tree

126 files changed

+1721
-1224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+1721
-1224
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ PHP NEWS
8383
message with traits). (villfa)
8484
. Implement ReflectionProperty::hasDefaultValue and
8585
Reflection::getDefaultValue (beberlei)
86+
. Implement ReflectionParameter::getDefaultValueString (kocsismate)
8687

8788
- Session:
8889
. Fixed bug #78624 (session_gc return value for user defined session

UPGRADING

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ PHP 8.0 UPGRADE NOTES
266266
representation of the type, and is no longer deprecated. In particular the
267267
result will include a nullability indicator for nullable types. The format
268268
of the return value is not stable and may change between PHP versions.
269+
. The following methods can now return information about default values of
270+
parameters of internal functions too:
271+
ReflectionParameter::isDefaultValueAvailable()
272+
ReflectionParameter::getDefaultValue()
273+
ReflectionParameter::isDefaultValueConstant()
274+
ReflectionParameter::getDefaultValueConstantName()
275+
. The ReflectionParameter::isDefaultValueConstant() and
276+
ReflectionParameter::getDefaultValueConstantName() methods have been deprecated.
269277

270278
- Socket:
271279
. The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES

Zend/tests/argument_restriction_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class Sub extends Base {
1313
}
1414
?>
1515
--EXPECTF--
16-
Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
16+
Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'lllllllllllllllllllllllllllllllllllllllllllllllllll') in %sargument_restriction_001.php on line %d

Zend/tests/argument_restriction_003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ class Sub extends Base {
1616
}
1717
?>
1818
--EXPECTF--
19-
Fatal error: Declaration of Sub::test() must be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_003.php on line %d
19+
Fatal error: Declaration of Sub::test() must be compatible with Base::test(Foo $foo, array $bar, $option = NULL, $extra = 'lllllllllllllllllllllllllllllllllllllllllllllllllll') in %sargument_restriction_003.php on line %d

Zend/tests/argument_restriction_006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class Sub extends Base {
1313
}
1414
?>
1515
--EXPECTF--
16-
Fatal error: Declaration of Sub::test($foo, $extra) must be compatible with Base::test($foo, $extra = Array) in %sargument_restriction_006.php on line %d
16+
Fatal error: Declaration of Sub::test($foo, $extra) must be compatible with Base::test($foo, $extra = ['test']) in %sargument_restriction_006.php on line %d

Zend/tests/bug64988.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ $o = new Smooth1();
2626
echo "okey";
2727
?>
2828
--EXPECTF--
29-
Fatal error: Declaration of Smooth1::insert(array $data) must be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 17
29+
Fatal error: Declaration of Smooth1::insert(array $data) must be compatible with Noisy1::insert(array $data, $option1 = Null) in %sbug64988.php on line 17

Zend/tests/bug70957.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ class B extends Foo
1919
}
2020
?>
2121
--EXPECTF--
22-
Fatal error: Declaration of T::bar() must be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
22+
Fatal error: Declaration of T::bar() must be compatible with Foo::bar($a = self::class) in %sbug70957.php on line %d

Zend/tests/bug71428.1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class B extends A {
99
public function m(array $a = []) {}
1010
}
1111
--EXPECTF--
12-
Fatal error: Declaration of B::m(array $a = Array) must be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
12+
Fatal error: Declaration of B::m(array $a = []) must be compatible with A::m(?array $a = null) in %sbug71428.1.php on line 6

Zend/tests/bug72119.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ class Hello implements Foo {
1515
echo "OK\n";
1616
?>
1717
--EXPECTF--
18-
Fatal error: Declaration of Hello::bar(array $baz = Array) must be compatible with Foo::bar(?array $baz = NULL) in %s on line %d
18+
Fatal error: Declaration of Hello::bar(array $baz = []) must be compatible with Foo::bar(?array $baz = null) in %s on line %d

Zend/tests/bug73987.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ class B extends A {
1515

1616
?>
1717
--EXPECTF--
18-
Fatal error: Declaration of B::example($a, $b, $c = NULL) must be compatible with A::example($a, $b = NULL, $c = NULL) in %s
18+
Fatal error: Declaration of B::example($a, $b, $c = null) must be compatible with A::example($a, $b = null, $c = null) in %s

Zend/tests/bug73987_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ class C extends B {
1717

1818
?>
1919
--EXPECTF--
20-
Fatal error: Declaration of C::example($a, $b, $c = NULL) must be compatible with B::example($a, $b = NULL, $c = NULL) in %s
20+
Fatal error: Declaration of C::example($a, $b, $c = null) must be compatible with B::example($a, $b = null, $c = null) in %s

Zend/tests/closures/closure_from_callable_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ $foo = new SubFoo;
8181
$fn = $foo->getSelfColonParentPublicInstanceMethod();
8282
echo $fn(" OK".PHP_EOL);
8383

84-
echo 'Access proteced instance method of parent object through "self::" to parent method';
84+
echo 'Access protected instance method of parent object through "self::" to parent method';
8585
$foo = new SubFoo;
8686
$fn = $foo->getSelfColonParentProtectedInstanceMethod();
8787
echo $fn(" OK".PHP_EOL);
@@ -114,6 +114,6 @@ Subclass closure over parent class static protected method OK
114114
Access public instance method of parent object through "parent::" OK
115115
Access public instance method of self object through "self::" OK
116116
Access public instance method of parent object through "self::" to parent method OK
117-
Access proteced instance method of parent object through "self::" to parent method OK
117+
Access protected instance method of parent object through "self::" to parent method OK
118118
MagicCall __call instance method __call,nonExistentMethod, OK
119119
MagicCall __callStatic static method __callStatic,nonExistentMethod, OK
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
The default value is a class constant in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
class MyDateTimeZone extends DateTimeZone
6+
{
7+
public static function listIdentifiers(int $what = DateTimeZone::ALL, bool $country = false)
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTimeZone::listIdentifiers(int $what = DateTimeZone::ALL, bool $country = false) must be compatible with DateTimeZone::listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null) in %s on line %d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
The default value is a constant in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
class MyDateTimeZone extends DateTimeZone
6+
{
7+
public function getTransitions(int $timestamp_begin = PHP_INT_MIN, bool $timestamp_end = false)
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTimeZone::getTransitions(int $timestamp_begin = PHP_INT_MIN, bool $timestamp_end = false) must be compatible with DateTimeZone::getTransitions(int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) in %s on line %d
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
The default value is false in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
6+
interface MyDateTimeInterface extends DateTimeInterface
7+
{
8+
public function diff(DateTimeInterface $object, int $absolute = 0);
9+
}
10+
--EXPECTF--
11+
Fatal error: Declaration of MyDateTimeInterface::diff(DateTimeInterface $object, int $absolute = 0) must be compatible with DateTimeInterface::diff(DateTimeInterface $object, bool $absolute = false) in %s on line %d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
The default value is an integer in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
class MyDateTime extends DateTime
6+
{
7+
public function setTime(int $hour, int $minute, int $second = 0, bool $microseconds = false)
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTime::setTime(int $hour, int $minute, int $second = 0, bool $microseconds = false) must be compatible with DateTime::setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0) in %s on line %d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
The default value is null in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
class MyDateTime extends DateTime
6+
{
7+
public static function createFromFormat(string $format, string $time, bool $timezone = false)
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTime::createFromFormat(string $format, string $time, bool $timezone = false) must be compatible with DateTime::createFromFormat(string $format, string $time, ?DateTimeZone $timezone = null) in %s on line %d

Zend/tests/type_declarations/variance/internal_parent.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class Test extends DateTime {
99

1010
?>
1111
--EXPECTF--
12-
Fatal error: Could not check compatibility between Test::createFromFormat($format, $time, ?Wrong $timezone = NULL) and DateTime::createFromFormat(string $format, string $time, ?DateTimeZone $timezone = NULL), because class Wrong is not available in %s on line %d
12+
Fatal error: Could not check compatibility between Test::createFromFormat($format, $time, ?Wrong $timezone = null) and DateTime::createFromFormat(string $format, string $time, ?DateTimeZone $timezone = null), because class Wrong is not available in %s on line %d

Zend/tests/variadic/adding_additional_optional_parameter_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class MySQL implements DB {
1313

1414
?>
1515
--EXPECTF--
16-
Fatal error: Declaration of MySQL::query($query, ?int $extraParam = NULL, string ...$params) must be compatible with DB::query($query, string ...$params) in %s on line %d
16+
Fatal error: Declaration of MySQL::query($query, ?int $extraParam = null, string ...$params) must be compatible with DB::query($query, string ...$params) in %s on line %d

Zend/zend_API.h

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -99,50 +99,61 @@ typedef struct _zend_fcall_info_cache {
9999
#define _ZEND_ARG_INFO_FLAGS(pass_by_ref, is_variadic) \
100100
(((pass_by_ref) << _ZEND_SEND_MODE_SHIFT) | ((is_variadic) ? _ZEND_IS_VARIADIC_BIT : 0))
101101

102+
/* Arginfo structures without type information */
102103
#define ZEND_ARG_INFO(pass_by_ref, name) \
103-
{ #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 0))},
104-
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
105-
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
106-
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) \
107-
{ #name, ZEND_TYPE_INIT_CODE(IS_ARRAY, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
108-
#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) \
109-
{ #name, ZEND_TYPE_INIT_CODE(IS_CALLABLE, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
110-
#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) \
111-
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
112-
#define ZEND_ARG_TYPE_MASK(pass_by_ref, name, type_mask) \
113-
{ #name, ZEND_TYPE_INIT_MASK(type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
104+
{ #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
105+
#define ZEND_ARG_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, default_value) \
106+
{ #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
114107
#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) \
115-
{ #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
108+
{ #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)), NULL },
109+
/* Arginfo structures with simple type information */
110+
#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) \
111+
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
112+
#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \
113+
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
116114
#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) \
117-
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
115+
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)), NULL },
116+
/* Arginfo structures with complex type information */
117+
#define ZEND_ARG_TYPE_MASK(pass_by_ref, name, type_mask, default_value) \
118+
{ #name, ZEND_TYPE_INIT_MASK(type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
119+
/* Arginfo structures with object type information */
120+
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
121+
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
122+
#define ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, classname, allow_null, default_value) \
123+
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
118124
#define ZEND_ARG_VARIADIC_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
119-
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
125+
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)), NULL },
126+
/* Legacy arginfo structures */
127+
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) \
128+
{ #name, ZEND_TYPE_INIT_CODE(IS_ARRAY, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
129+
#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) \
130+
{ #name, ZEND_TYPE_INIT_CODE(IS_CALLABLE, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },
120131

121132
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
122133
static const zend_internal_arg_info name[] = { \
123134
{ (const char*)(zend_uintptr_t)(required_num_args), \
124-
ZEND_TYPE_INIT_CLASS_CONST(#class_name, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
135+
ZEND_TYPE_INIT_CLASS_CONST(#class_name, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)), NULL },
125136

126137
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(name, class_name, allow_null) \
127138
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, 0, -1, class_name, allow_null)
128139

129140
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \
130141
static const zend_internal_arg_info name[] = { \
131-
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
142+
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)), NULL },
132143

133144
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, return_reference, required_num_args, class_name, type) \
134145
static const zend_internal_arg_info name[] = { \
135-
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
146+
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)), NULL },
136147

137148
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
138149
static const zend_internal_arg_info name[] = { \
139-
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
150+
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)), NULL },
140151
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(name, type, allow_null) \
141152
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, 0, -1, type, allow_null)
142153

143154
#define ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) \
144155
static const zend_internal_arg_info name[] = { \
145-
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
156+
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0)), NULL },
146157
#define ZEND_BEGIN_ARG_INFO(name, _unused) \
147158
ZEND_BEGIN_ARG_INFO_EX(name, {}, ZEND_RETURN_VALUE, -1)
148159
#define ZEND_END_ARG_INFO() };

Zend/zend_builtin_functions_arginfo.h

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ZEND_END_ARG_INFO()
3535
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_define, 0, 2, _IS_BOOL, 0)
3636
ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
3737
ZEND_ARG_INFO(0, value)
38-
ZEND_ARG_TYPE_INFO(0, case_insensitive, _IS_BOOL, 0)
38+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, case_insensitive, _IS_BOOL, 0, "false")
3939
ZEND_END_ARG_INFO()
4040

4141
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0)
@@ -56,10 +56,14 @@ ZEND_END_ARG_INFO()
5656
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_subclass_of, 0, 2, _IS_BOOL, 0)
5757
ZEND_ARG_INFO(0, object)
5858
ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
59-
ZEND_ARG_TYPE_INFO(0, allow_string, _IS_BOOL, 0)
59+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allow_string, _IS_BOOL, 0, "true")
6060
ZEND_END_ARG_INFO()
6161

62-
#define arginfo_is_a arginfo_is_subclass_of
62+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_a, 0, 2, _IS_BOOL, 0)
63+
ZEND_ARG_INFO(0, object)
64+
ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
65+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, allow_string, _IS_BOOL, 0, "false")
66+
ZEND_END_ARG_INFO()
6367

6468
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class_vars, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
6569
ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
@@ -87,14 +91,14 @@ ZEND_END_ARG_INFO()
8791

8892
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_exists, 0, 1, _IS_BOOL, 0)
8993
ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
90-
ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
94+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true")
9195
ZEND_END_ARG_INFO()
9296

9397
#define arginfo_interface_exists arginfo_class_exists
9498

9599
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trait_exists, 0, 1, _IS_BOOL, 0)
96100
ZEND_ARG_TYPE_INFO(0, traitname, IS_STRING, 0)
97-
ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
101+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true")
98102
ZEND_END_ARG_INFO()
99103

100104
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_function_exists, 0, 1, _IS_BOOL, 0)
@@ -104,7 +108,7 @@ ZEND_END_ARG_INFO()
104108
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_alias, 0, 2, _IS_BOOL, 0)
105109
ZEND_ARG_TYPE_INFO(0, user_class_name, IS_STRING, 0)
106110
ZEND_ARG_TYPE_INFO(0, alias_name, IS_STRING, 0)
107-
ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
111+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true")
108112
ZEND_END_ARG_INFO()
109113

110114
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_included_files, 0, 0, IS_ARRAY, 0)
@@ -114,14 +118,14 @@ ZEND_END_ARG_INFO()
114118

115119
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trigger_error, 0, 1, _IS_BOOL, 0)
116120
ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
117-
ZEND_ARG_TYPE_INFO(0, error_type, IS_LONG, 0)
121+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, error_type, IS_LONG, 0, "E_USER_NOTICE")
118122
ZEND_END_ARG_INFO()
119123

120124
#define arginfo_user_error arginfo_trigger_error
121125

122126
ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
123127
ZEND_ARG_INFO(0, error_handler)
124-
ZEND_ARG_TYPE_INFO(0, error_types, IS_LONG, 0)
128+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, error_types, IS_LONG, 0, "E_ALL")
125129
ZEND_END_ARG_INFO()
126130

127131
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_restore_error_handler, 0, 0, _IS_BOOL, 0)
@@ -140,7 +144,7 @@ ZEND_END_ARG_INFO()
140144
#define arginfo_get_declared_interfaces arginfo_get_included_files
141145

142146
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_ARRAY, 0)
143-
ZEND_ARG_TYPE_INFO(0, exclude_disabled, _IS_BOOL, 0)
147+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, exclude_disabled, _IS_BOOL, 0, "false")
144148
ZEND_END_ARG_INFO()
145149

146150
#define arginfo_get_defined_vars arginfo_get_included_files
@@ -154,21 +158,21 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resources, 0, 0, IS_ARRAY, 0
154158
ZEND_END_ARG_INFO()
155159

156160
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_loaded_extensions, 0, 0, IS_ARRAY, 0)
157-
ZEND_ARG_TYPE_INFO(0, zend_extensions, _IS_BOOL, 0)
161+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, zend_extensions, _IS_BOOL, 0, "false")
158162
ZEND_END_ARG_INFO()
159163

160164
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_constants, 0, 0, IS_ARRAY, 0)
161-
ZEND_ARG_TYPE_INFO(0, categorize, _IS_BOOL, 0)
165+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, categorize, _IS_BOOL, 0, "false")
162166
ZEND_END_ARG_INFO()
163167

164168
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_backtrace, 0, 0, IS_ARRAY, 0)
165-
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
166-
ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
169+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "DEBUG_BACKTRACE_PROVIDE_OBJECT")
170+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "0")
167171
ZEND_END_ARG_INFO()
168172

169173
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_print_backtrace, 0, 0, IS_VOID, 0)
170-
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
171-
ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
174+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0")
175+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "0")
172176
ZEND_END_ARG_INFO()
173177

174178
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extension_loaded, 0, 1, _IS_BOOL, 0)

0 commit comments

Comments
 (0)