Skip to content

Commit 809daa8

Browse files
committed
Update tests
1 parent bdda5c0 commit 809daa8

36 files changed

+367
-77
lines changed

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 = 'llllllllll...') in %s 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 = 'llllllllll...') in %s 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 = Array) in %s 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 %s on line %d

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 = 'Foo') in %s 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 = Array) must be compatible with A::m(?array $a = 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 on line %d

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 on line %d

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()
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTimeZone::listIdentifiers() 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()
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTimeZone::getTransitions() 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();
9+
}
10+
--EXPECTF--
11+
Fatal error: Declaration of MyDateTimeInterface::diff() 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()
8+
{
9+
}
10+
}
11+
--EXPECTF--
12+
Fatal error: Declaration of MyDateTime::createFromFormat() must be compatible with DateTime::createFromFormat(string $format, string $time, ?DateTimeZone $timezone = null) in %s on line %d
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
The default value is a constant in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
6+
use Foo\Bar;
7+
8+
class A
9+
{
10+
public function foo(
11+
$param1 = \Foo\Bar::CONSTANT,
12+
$param2 = Foo\Bar::CONSTANT,
13+
$param3 = Bar::CONSTANT
14+
) {
15+
}
16+
}
17+
18+
class B extends A
19+
{
20+
public function foo()
21+
{
22+
}
23+
}
24+
--EXPECTF--
25+
Fatal error: Declaration of B::foo() must be compatible with A::foo($param1 = Foo\Bar::CONSTANT, $param2 = Foo\Bar::CONSTANT, $param3 = Foo\Bar::CONSTANT) in %s on line %d
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
The default value is a constant in the parent class method's signature.
3+
--FILE--
4+
<?php
5+
6+
use const Foo\CONSTANT;
7+
8+
class A
9+
{
10+
public function foo(
11+
$param1 = \Foo\CONSTANT,
12+
$param2 = Foo\CONSTANT,
13+
$param3 = CONSTANT
14+
) {
15+
}
16+
}
17+
18+
class B extends A
19+
{
20+
public function foo()
21+
{
22+
}
23+
}
24+
--EXPECTF--
25+
Fatal error: Declaration of B::foo() must be compatible with A::foo($param1 = Foo\CONSTANT, $param2 = Foo\CONSTANT, $param3 = Foo\CONSTANT) 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

ext/intl/tests/locale/bug74993.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,39 @@ Function [ <internal:intl> function locale_get_display_language ] {
2323

2424
- Parameters [2] {
2525
Parameter #0 [ <required> string $locale ]
26-
Parameter #1 [ <optional> ?string $in_locale ]
26+
Parameter #1 [ <optional> ?string $in_locale = null ]
2727
}
2828
- Return [ string|false ]
2929
}
3030
Function [ <internal:intl> function locale_get_display_name ] {
3131

3232
- Parameters [2] {
3333
Parameter #0 [ <required> string $locale ]
34-
Parameter #1 [ <optional> ?string $in_locale ]
34+
Parameter #1 [ <optional> ?string $in_locale = null ]
3535
}
3636
- Return [ string|false ]
3737
}
3838
Function [ <internal:intl> function locale_get_display_region ] {
3939

4040
- Parameters [2] {
4141
Parameter #0 [ <required> string $locale ]
42-
Parameter #1 [ <optional> ?string $in_locale ]
42+
Parameter #1 [ <optional> ?string $in_locale = null ]
4343
}
4444
- Return [ string|false ]
4545
}
4646
Function [ <internal:intl> function locale_get_display_script ] {
4747

4848
- Parameters [2] {
4949
Parameter #0 [ <required> string $locale ]
50-
Parameter #1 [ <optional> ?string $in_locale ]
50+
Parameter #1 [ <optional> ?string $in_locale = null ]
5151
}
5252
- Return [ string|false ]
5353
}
5454
Function [ <internal:intl> function locale_get_display_variant ] {
5555

5656
- Parameters [2] {
5757
Parameter #0 [ <required> string $locale ]
58-
Parameter #1 [ <optional> ?string $in_locale ]
58+
Parameter #1 [ <optional> ?string $in_locale = null ]
5959
}
6060
- Return [ string|false ]
6161
}
@@ -64,7 +64,7 @@ Function [ <internal:intl> function locale_filter_matches ] {
6464
- Parameters [3] {
6565
Parameter #0 [ <required> string $langtag ]
6666
Parameter #1 [ <required> string $locale ]
67-
Parameter #2 [ <optional> bool $canonicalize ]
67+
Parameter #2 [ <optional> bool $canonicalize = false ]
6868
}
6969
- Return [ ?bool ]
7070
}
@@ -73,8 +73,8 @@ Function [ <internal:intl> function locale_lookup ] {
7373
- Parameters [4] {
7474
Parameter #0 [ <required> array $langtag ]
7575
Parameter #1 [ <required> string $locale ]
76-
Parameter #2 [ <optional> bool $canonicalize ]
77-
Parameter #3 [ <optional> ?string $def ]
76+
Parameter #2 [ <optional> bool $canonicalize = false ]
77+
Parameter #3 [ <optional> ?string $def = null ]
7878
}
7979
- Return [ ?string ]
8080
}

ext/reflection/tests/ReflectionClass_toString_001.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
131131
Method [ <internal:Reflection> public method getMethods ] {
132132

133133
- Parameters [1] {
134-
Parameter #0 [ <optional> ?int $filter ]
134+
Parameter #0 [ <optional> ?int $filter = null ]
135135
}
136136
}
137137

@@ -152,7 +152,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
152152
Method [ <internal:Reflection> public method getProperties ] {
153153

154154
- Parameters [1] {
155-
Parameter #0 [ <optional> ?int $filter ]
155+
Parameter #0 [ <optional> ?int $filter = null ]
156156
}
157157
}
158158

@@ -259,7 +259,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
259259
Method [ <internal:Reflection> public method newInstance ] {
260260

261261
- Parameters [1] {
262-
Parameter #0 [ <optional> ...$args ]
262+
Parameter #0 [ <optional> ...$args = <default> ]
263263
}
264264
}
265265

@@ -272,7 +272,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
272272
Method [ <internal:Reflection> public method newInstanceArgs ] {
273273

274274
- Parameters [1] {
275-
Parameter #0 [ <optional> array $args ]
275+
Parameter #0 [ <optional> array $args = [] ]
276276
}
277277
}
278278

@@ -299,7 +299,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector, String
299299

300300
- Parameters [2] {
301301
Parameter #0 [ <required> string $name ]
302-
Parameter #1 [ <optional> $default ]
302+
Parameter #1 [ <optional> $default = <default> ]
303303
}
304304
}
305305

ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1, $test3 =
1111
$reflect = new ReflectionFunction('ReflectionParameterTest');
1212
foreach($reflect->getParameters() as $param) {
1313
if($param->getName() == 'test1') {
14-
var_dump($param->isDefaultValueConstant());
14+
var_dump(@$param->isDefaultValueConstant());
1515
}
1616
if($param->getName() == 'test2') {
17-
var_dump($param->isDefaultValueConstant());
17+
var_dump(@$param->isDefaultValueConstant());
1818
}
19-
if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
20-
var_dump($param->getDefaultValueConstantName());
19+
if($param->isDefaultValueAvailable() && @$param->isDefaultValueConstant()) {
20+
var_dump(@$param->getDefaultValueConstantName());
2121
}
2222
}
2323

@@ -36,8 +36,8 @@ $method = new ReflectionMethod('Foo', 'baz');
3636
$params = $method->getParameters();
3737

3838
foreach ($params as $param) {
39-
if ($param->isDefaultValueConstant()) {
40-
var_dump($param->getDefaultValueConstantName());
39+
if (@$param->isDefaultValueConstant()) {
40+
var_dump(@$param->getDefaultValueConstantName());
4141
}
4242
}
4343
?>

ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ namespace {
1717
}
1818
$reflect = new ReflectionFunction('ReflectionParameterTest');
1919
foreach($reflect->getParameters() as $param) {
20-
if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
21-
echo $param->getDefaultValueConstantName() . "\n";
20+
if($param->isDefaultValueAvailable() && @$param->isDefaultValueConstant()) {
21+
echo @$param->getDefaultValueConstantName() . "\n";
2222
}
2323
}
24-
echo "==DONE==";
2524
}
2625
?>
2726
--EXPECT--
2827
ReflectionTestNamespace\TestClass::TEST_CONST_2
2928
ReflectionTestNamespace\CONST_TEST_1
30-
==DONE==

ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ $reflect = new ReflectionFunction('ReflectionParameterTest');
1212
foreach($reflect->getParameters() as $param) {
1313
try {
1414
echo $param->getDefaultValueConstantName() . "\n";
15-
}
16-
catch(ReflectionException $e) {
15+
} catch(ReflectionException $e) {
1716
echo $e->getMessage() . "\n";
1817
}
1918
}
2019
?>
21-
--EXPECT--
20+
--EXPECTF--
21+
Deprecated: Function ReflectionParameter::getDefaultValueConstantName() is deprecated in %s on line %d
2222
Internal error: Failed to retrieve the default value
23+
24+
Deprecated: Function ReflectionParameter::getDefaultValueConstantName() is deprecated in %s on line %d
2325
CONST_TEST_1

ext/reflection/tests/ReflectionParameter_export_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ foreach($reflect->getParameters() as $key => $value) {
1212
echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
1313
}
1414
?>
15-
--EXPECTF--
15+
--EXPECT--
1616
Parameter #0 [ <required> $test ]
1717
Parameter #1 [ <optional> $test2 = NULL ]

ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ Function [ <user> function ReflectionParameterTest ] {
3232
Parameter #1 [ <optional> $test2 = NULL ]
3333
}
3434
}
35-

ext/reflection/tests/ReflectionParameter_toString_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ foreach($params as $key => $value) {
1616
--EXPECT--
1717
Parameter #0 [ <required> $test ]
1818
Parameter #1 [ <optional> $test2 = NULL ]
19-
Parameter #2 [ <optional> ...$test3 ]
19+
Parameter #2 [ <optional> ...$test3 = ]

0 commit comments

Comments
 (0)