Skip to content

Commit 60ff17c

Browse files
committed
Fix tests
1 parent c45eb54 commit 60ff17c

File tree

224 files changed

+837
-768
lines changed

Some content is hidden

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

224 files changed

+837
-768
lines changed

Zend/tests/bug21478.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #21478 (Zend/zend_alloc.c :: shutdown_memory_manager produces segfault)
33
--FILE--
44
<?php
55
class debugfilter extends php_user_filter {
6-
function filter($in, $out, &$consumed, $closing) {
6+
function filter($in, $out, &$consumed, $closing): int {
77
while ($bucket = stream_bucket_make_writeable($in)) {
88
$bucket->data = strtoupper($bucket->data);
99
stream_bucket_append($out, $bucket);

Zend/tests/bug78406.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (!class_exists(SampleFilter::class)) {
1010
{
1111
private $data = '';
1212

13-
public function filter($in, $out, &$consumed, $closing)
13+
public function filter($in, $out, &$consumed, $closing): int
1414
{
1515
while ($bucket = stream_bucket_make_writeable($in))
1616
{

Zend/tests/foreach_004.phpt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,26 @@ class IT extends ArrayIterator {
1616
}
1717
}
1818

19-
function rewind() {$this->trap(__FUNCTION__); return parent::rewind();}
20-
function valid() {$this->trap(__FUNCTION__); return parent::valid();}
21-
function key() {$this->trap(__FUNCTION__); return parent::key();}
22-
function next() {$this->trap(__FUNCTION__); return parent::next();}
19+
function rewind(): void
20+
{
21+
$this->trap(__FUNCTION__);
22+
parent::rewind();
23+
}
24+
25+
function valid(): bool {
26+
$this->trap(__FUNCTION__);
27+
return parent::valid();
28+
}
29+
30+
function key(): mixed {
31+
$this->trap(__FUNCTION__);
32+
return parent::key();
33+
}
34+
35+
function next(): void {
36+
$this->trap(__FUNCTION__);
37+
parent::next();
38+
}
2339
}
2440

2541
foreach(['rewind', 'valid', 'key', 'next'] as $trap) {

Zend/tests/ns_054.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
namespace test\ns1;
66

77
class Foo implements \SplObserver {
8-
function update(\SplSubject $x) {
8+
function update(\SplSubject $x): void {
99
echo "ok\n";
1010
}
1111
}
1212

1313
class Bar implements \SplSubject {
14-
function attach(\SplObserver $x) {
14+
function attach(\SplObserver $x): void {
1515
echo "ok\n";
1616
}
17-
function notify() {
17+
function notify(): void {
1818
}
19-
function detach(\SplObserver $x) {
19+
function detach(\SplObserver $x): void {
2020
}
2121
}
2222
$foo = new Foo();

Zend/tests/ns_056.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ namespace test\ns1;
66
use \SplObserver;
77

88
class Foo implements SplObserver {
9-
function update(\SplSubject $x) {
9+
function update(\SplSubject $x): void {
1010
echo "ok\n";
1111
}
1212
}
1313

1414
class Bar implements \SplSubject {
15-
function attach(SplObserver $x) {
15+
function attach(SplObserver $x): void {
1616
echo "ok\n";
1717
}
18-
function notify() {
18+
function notify(): void {
1919
}
20-
function detach(SplObserver $x) {
20+
function detach(SplObserver $x): void {
2121
}
2222
}
2323
$foo = new Foo();

Zend/tests/type_declarations/variance/internal_parent/incompatible_return_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ class MyDateTimeZone extends DateTimeZone
1313
var_dump(MyDateTimeZone::listIdentifiers());
1414
?>
1515
--EXPECTF--
16-
Strict Standards: Declaration of MyDateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): string should be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array in %s on line %d
16+
Deprecated: Declaration of MyDateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): string should be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array in %s on line %d
1717
string(0) ""

Zend/tests/type_declarations/variance/internal_parent/missing_return_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ class MyDateTimeZone extends DateTimeZone
1010
}
1111
?>
1212
--EXPECTF--
13-
Strict Standards: Declaration of MyDateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) should be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array in %s on line %d
13+
Deprecated: Declaration of MyDateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) should be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null): array in %s on line %d

Zend/tests/type_declarations/variance/optional_return_type/incompatible_return_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ $bar = new Bar();
2323
var_dump($bar->x());
2424
?>
2525
--EXPECTF--
26-
Strict Standards: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
26+
Deprecated: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
2727
array(0) {
2828
}

Zend/tests/type_declarations/variance/optional_return_type/incompatible_return_type2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ $bar = new Bar();
2323
var_dump($bar->x());
2424
?>
2525
--EXPECTF--
26-
Strict Standards: Declaration of Bar::x() should be compatible with Foo::x(): string|false in %s on line %d
26+
Deprecated: Declaration of Bar::x() should be compatible with Foo::x(): string|false in %s on line %d
2727
array(0) {
2828
}

Zend/tests/type_declarations/variance/optional_return_type/incompatible_return_type3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ class Baz extends Bar
2929

3030
?>
3131
--EXPECTF--
32-
Strict Standards: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
32+
Deprecated: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
3333

3434
Fatal error: Declaration of Baz::x() must be compatible with Bar::x(): array in %s on line %d

Zend/tests/type_declarations/variance/optional_return_type/suppressed_incompatible_return_type3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ $baz = new Baz();
3333
var_dump($baz->x());
3434
?>
3535
--EXPECTF--
36-
Strict Standards: Declaration of Baz::x(): array|false should be compatible with Bar::x(): array in %s on line %d
36+
Deprecated: Declaration of Baz::x(): array|false should be compatible with Bar::x(): array in %s on line %d
3737
array(0) {
3838
}

Zend/tests/type_declarations/variance/optional_return_type/suppressed_incompatible_return_type4.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ $baz = new Baz();
3232
var_dump($baz->x());
3333
?>
3434
--EXPECTF--
35-
Strict Standards: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
35+
Deprecated: Declaration of Bar::x(): array should be compatible with Foo::x(): string|false in %s on line %d
3636
array(0) {
3737
}

Zend/zend_exceptions_arginfo.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()
66

7-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Throwable_getCode, 0, 0, 0)
7+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getCode, 0, 0, IS_LONG, 0)
88
ZEND_END_ARG_INFO()
99

1010
#define arginfo_class_Throwable_getFile arginfo_class_Throwable_getMessage
@@ -29,7 +29,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Exception___construct, 0, 0, 0)
2929
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, previous, Throwable, 1, "null")
3030
ZEND_END_ARG_INFO()
3131

32-
#define arginfo_class_Exception___wakeup arginfo_class_Throwable_getCode
32+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Exception___wakeup, 0, 0, IS_VOID, 0)
33+
ZEND_END_ARG_INFO()
3334

3435
#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage
3536

@@ -62,7 +63,7 @@ ZEND_END_ARG_INFO()
6263

6364
#define arginfo_class_Error___construct arginfo_class_Exception___construct
6465

65-
#define arginfo_class_Error___wakeup arginfo_class_Throwable_getCode
66+
#define arginfo_class_Error___wakeup arginfo_class_Exception___wakeup
6667

6768
#define arginfo_class_Error_getMessage arginfo_class_Throwable_getMessage
6869

ext/intl/converter/converter.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function convert(string $str, bool $reverse = false) {}
1111

1212
/**
1313
* @param int $error
14-
* @return string|null
14+
* @return string|int|array|null
1515
*/
1616
public function fromUCallback(int $reason, array $source, int $codePoint, &$error) {}
1717

@@ -59,7 +59,7 @@ public function setSubstChars(string $chars) {}
5959

6060
/**
6161
* @param int $error
62-
* @return string|null
62+
* @return string|int|array|null
6363
*/
6464
public function toUCallback(int $reason, string $source, string $codeUnits, &$error) {}
6565

ext/intl/converter/converter_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: c01b6c9d6a6754a2fffde1279bec3a984e6a2f34 */
2+
* Stub hash: ede345fc0cbc16ca968535b96a93c0479451764e */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null")
@@ -11,7 +11,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_UConverter_conve
1111
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, reverse, _IS_BOOL, 0, "false")
1212
ZEND_END_ARG_INFO()
1313

14-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_UConverter_fromUCallback, 0, 4, IS_STRING, 1)
14+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_UConverter_fromUCallback, 0, 4, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_ARRAY|MAY_BE_NULL)
1515
ZEND_ARG_TYPE_INFO(0, reason, IS_LONG, 0)
1616
ZEND_ARG_TYPE_INFO(0, source, IS_ARRAY, 0)
1717
ZEND_ARG_TYPE_INFO(0, codePoint, IS_LONG, 0)
@@ -60,7 +60,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_UConverter_setSu
6060
ZEND_ARG_TYPE_INFO(0, chars, IS_STRING, 0)
6161
ZEND_END_ARG_INFO()
6262

63-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_UConverter_toUCallback, 0, 4, IS_STRING, 1)
63+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_UConverter_toUCallback, 0, 4, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_ARRAY|MAY_BE_NULL)
6464
ZEND_ARG_TYPE_INFO(0, reason, IS_LONG, 0)
6565
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
6666
ZEND_ARG_TYPE_INFO(0, codeUnits, IS_STRING, 0)

ext/intl/tests/uconverter_oop_callback.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class MyConverter extends UConverter {
99
/**
1010
* Called during conversion from source encoding to internal UChar representation
1111
*/
12-
public function toUCallback($reason, $source, $codeUnits, &$error) {
12+
public function toUCallback($reason, $source, $codeUnits, &$error): string|int|array|null {
1313
echo "toUCallback(", UConverter::reasonText($reason), ", ...)\n";
1414
return parent::toUCallback($reason, $source, $codeUnits, $error);
1515
}
1616

1717
/**
1818
* Called during conversion from internal UChar to destination encoding
1919
*/
20-
public function fromUCallback($reason, $source, $codePoint, &$error) {
20+
public function fromUCallback($reason, $source, $codePoint, &$error): string|int|array|null {
2121
echo "fromUCallback(", UConverter::reasonText($reason), ", ...)\n";
2222
return parent::fromUCallback($reason, $source, $codePoint, $error);
2323
}

ext/intl/tests/uconverter_oop_callback2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class MyConverter extends UConverter {
99
/**
1010
* Called during conversion from source encoding to internal UChar representation
1111
*/
12-
public function toUCallback($reason, $source, $codeUnits, &$error) {
12+
public function toUCallback($reason, $source, $codeUnits, &$error): string|int|array|null {
1313
echo "toUCallback(", UConverter::reasonText($reason), ", ...)\n";
1414
return parent::toUCallback($reason, $source, $codeUnits, $error);
1515
}
1616

1717
/**
1818
* Called during conversion from internal UChar to destination encoding
1919
*/
20-
public function fromUCallback($reason, $source, $codePoint, &$error) {
20+
public function fromUCallback($reason, $source, $codePoint, &$error): string|int|array|null {
2121
echo "fromUCallback(", UConverter::reasonText($reason), ", ...)\n";
2222
return parent::fromUCallback($reason, $source, $codePoint, $error);
2323
}

ext/intl/tests/uconverter_oop_callback_return.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@ UConverter::convert() w/ Callback Return Values
55
--FILE--
66
<?php
77
class MyConverter extends UConverter {
8-
public function toUCallback($reason, $source, $codeUnits, &$error) {
8+
public function toUCallback($reason, $source, $codeUnits, &$error): string|int|array|null {
99
$error = U_ZERO_ERROR;
1010
switch ($codeUnits) {
1111
case "\x80": return NULL;
1212
case "\x81": return 'a';
1313
case "\x82": return ord('b');
1414
case "\x83": return array('c');
1515
}
16+
17+
return null;
1618
}
1719

1820
/**
1921
* Called during conversion from internal UChar to destination encoding
2022
*/
21-
public function fromUCallback($reason, $source, $codePoint, &$error) {
23+
public function fromUCallback($reason, $source, $codePoint, &$error): string|int|array|null {
2224
$error = U_ZERO_ERROR;
2325
switch ($codePoint) {
2426
case 0x00F1: return "A";
2527
case 0x00F2: return ord("B");
2628
case 0x00F3: return array("C");
2729
case 0x00F4: return NULL;
2830
}
31+
32+
return null;
2933
}
3034

3135
}

ext/json/tests/bug61978.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class JsonTest2 implements JsonSerializable {
1717
public function __construct() {
1818
$this->test = '123';
1919
}
20-
public function jsonSerialize() {
20+
public function jsonSerialize(): mixed {
2121
return array(
2222
'test' => $this->test,
2323
'me' => $this

ext/json/tests/bug66025.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #66025 (Indent wrong when json_encode() called from jsonSerialize function)
44
<?php
55

66
class Foo implements JsonSerializable {
7-
public function jsonSerialize() {
7+
public function jsonSerialize(): mixed {
88
return json_encode([1], JSON_PRETTY_PRINT);
99
}
1010
}

ext/json/tests/bug68992.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #68992 (json_encode stacks exceptions thrown by JsonSerializable classes)
44
<?php
55

66
class MyClass implements JsonSerializable {
7-
public function jsonSerialize() {
7+
public function jsonSerialize(): mixed {
88
throw new Exception('Not implemented!');
99
}
1010
}

ext/json/tests/bug71835.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSeriali
33
--FILE--
44
<?php
55
class SomeClass implements JsonSerializable {
6-
public function jsonSerialize() {
6+
public function jsonSerialize(): mixed {
77
return [get_object_vars($this)];
88
}
99
}
@@ -12,7 +12,7 @@ $arr = [$class];
1212
var_dump(json_encode($arr));
1313

1414
class SomeClass2 implements JsonSerializable {
15-
public function jsonSerialize() {
15+
public function jsonSerialize(): mixed {
1616
return [(array)$this];
1717
}
1818
}

ext/json/tests/bug72069.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var_dump($result);
88

99
class A implements \JsonSerializable
1010
{
11-
function jsonSerialize()
11+
function jsonSerialize(): mixed
1212
{
1313
return ['end' => json_decode('', true)];
1414
}

ext/json/tests/bug73113.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Also test that the custom exception is not wrapped by ext/json
66

77
class JsonSerializableObject implements \JsonSerializable
88
{
9-
public function jsonSerialize()
9+
public function jsonSerialize(): mixed
1010
{
1111
throw new \Exception('This error is expected');
1212
}

ext/json/tests/bug77843.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Bug #77843: Use after free with json serializer
55

66
class X implements JsonSerializable {
77
public $prop = "value";
8-
public function jsonSerialize() {
8+
public function jsonSerialize(): mixed {
99
global $arr;
1010
unset($arr[0]);
1111
var_dump($this);

ext/json/tests/serialize.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ class NonSerializingTest
1717

1818
class SerializingTest extends NonSerializingTest implements JsonSerializable
1919
{
20-
public function jsonSerialize()
20+
public function jsonSerialize(): mixed
2121
{
2222
return $this->data;
2323
}
2424
}
2525

2626
class ValueSerializingTest extends SerializingTest
2727
{
28-
public function jsonSerialize()
28+
public function jsonSerialize(): mixed
2929
{
3030
return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data));
3131
}
3232
}
3333

3434
class SelfSerializingTest extends SerializingTest
3535
{
36-
public function jsonSerialize()
36+
public function jsonSerialize(): mixed
3737
{
3838
return $this;
3939
}

ext/mysqli/mysqli.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function get_server_info() {}
181181
public function get_warnings() {}
182182

183183
/**
184-
* @return mysqli|false
184+
* @return mysqli|null|false
185185
*/
186186
public function init() {}
187187

0 commit comments

Comments
 (0)