Skip to content

Commit 42989bb

Browse files
committed
Fix tests
1 parent 023223e commit 42989bb

File tree

131 files changed

+273
-254
lines changed

Some content is hidden

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

131 files changed

+273
-254
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/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
}

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

ext/mysqli/mysqli_arginfo.h

Lines changed: 2 additions & 2 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: efd018f81d09a704e3a9cea00dd562feb48ca0bb */
2+
* Stub hash: 39eb915ea92ef78691e722dd3a37ff45451b54d8 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
55
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
@@ -477,7 +477,7 @@ ZEND_END_ARG_INFO()
477477
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_mysqli_get_warnings, 0, 0, mysqli_warning, MAY_BE_FALSE)
478478
ZEND_END_ARG_INFO()
479479

480-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_mysqli_init, 0, 0, mysqli, MAY_BE_FALSE)
480+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_mysqli_init, 0, 0, mysqli, MAY_BE_NULL|MAY_BE_FALSE)
481481
ZEND_END_ARG_INFO()
482482

483483
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_mysqli_kill, 0, 1, _IS_BOOL, 0)

ext/opcache/tests/bug64353.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ opcache.enable_cli=1
99
--FILE--
1010
<?php
1111
class BugLoader extends php_user_filter {
12-
public function filter($in, $out, &$consumed, $closing) {
12+
public function filter($in, $out, &$consumed, $closing): int {
1313
if (!class_exists("Test")) {
1414
eval("class Test extends ArrayObject {}");
1515
}

ext/opcache/tests/bug74596.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ file_put_contents(__DIR__ . "/bug74596_2.php", "ok\n");
3232

3333
class ufilter extends php_user_filter
3434
{
35-
function filter($in, $out, &$consumed, $closing)
35+
function filter($in, $out, &$consumed, $closing): int
3636
{
3737
include_once __DIR__ . "/bug74596_1.php";
3838
while ($bucket = stream_bucket_make_writeable($in)) {

ext/pdo/tests/bug_47769.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ class test extends PDO
1717
echo "this is a private method.\n";
1818
}
1919

20-
public function quote($str, $paramtype = NULL) {
20+
public function quote($str, $paramtype = NULL): string|false {
2121
$this->isProtected();
2222
$this->isPrivate();
2323
print $str ."\n";
24+
25+
return $str;
2426
}
2527
}
2628

ext/pdo/tests/pdo_023.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PDODatabaseX extends PDO
4747
$this->test2 = 22;
4848
}
4949

50-
function query($sql, ...$rest)
50+
function query($sql, ...$rest): PDOStatement|false
5151
{
5252
echo __METHOD__ . "()\n";
5353
$stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx')));

ext/pdo/tests/pdo_026.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PDODatabase extends PDO
4242
echo __METHOD__ . "()\n";
4343
}
4444

45-
function query($sql, ...$rest)
45+
function query($sql, ...$rest): PDOStatement|false
4646
{
4747
echo __METHOD__ . "()\n";
4848
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));

ext/pdo/tests/pdo_029.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class PDOStatementX extends PDOStatement
3434
echo __METHOD__ . "()\n";
3535
}
3636

37-
function execute($params = array())
37+
function execute($params = array()): bool
3838
{
3939
echo __METHOD__ . "()\n";
40-
parent::execute();
40+
return parent::execute();
4141
}
4242
}
4343

@@ -48,7 +48,7 @@ class PDODatabase extends PDO
4848
echo __METHOD__ . "()\n";
4949
}
5050

51-
function query($sql, ...$rest)
51+
function query($sql, ...$rest): PDOStatement|false
5252
{
5353
echo __METHOD__ . "()\n";
5454
$stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));

ext/pdo/tests/pdo_030.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PDOStatementX extends PDOStatement
3535
echo __METHOD__ . "()\n";
3636
}
3737

38-
function execute($params = array())
38+
function execute($params = array()): bool
3939
{
4040
echo __METHOD__ . "()\n";
4141
parent::execute();
@@ -49,7 +49,7 @@ class PDODatabase extends PDO
4949
echo __METHOD__ . "()\n";
5050
}
5151

52-
function query($sql, ...$rest)
52+
function query($sql, ...$rest): PDOStatement|false
5353
{
5454
echo __METHOD__ . "()\n";
5555
return parent::query($sql);

0 commit comments

Comments
 (0)