Skip to content

Commit 7d52439

Browse files
committed
Deprecate implicit nullable parameters
1 parent fc1e6b3 commit 7d52439

31 files changed

+59
-38
lines changed

Zend/tests/bug63635.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Node {
66
public $parent = NULL;
77
public $children = array();
88

9-
function __construct(Node $parent=NULL) {
9+
function __construct(?Node $parent=NULL) {
1010
if ($parent) {
1111
$parent->children[] = $this;
1212
}

Zend/tests/bug71428.1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ bug #71428.1: inheritance with null default values
33
--FILE--
44
<?php
55
class A {
6-
public function m(array $a = null) {}
6+
public function m(?array $a = null) {}
77
}
88
class B extends A {
99
public function m(array $a = []) {}

Zend/tests/bug71428.3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ bug #71428: Validation type inheritance with = NULL
33
--FILE--
44
<?php
55
class A { }
6-
class B { public function m(A $a = NULL, $n) { echo "B.m";} };
6+
class B { public function m(?A $a = NULL, $n) { echo "B.m";} };
77
class C extends B { public function m(A $a , $n) { echo "C.m";} };
88
?>
99
--EXPECTF--

Zend/tests/bug72119.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ class Hello implements Foo {
1515
echo "OK\n";
1616
?>
1717
--EXPECTF--
18+
Deprecated: Implicit nullable types are deprecated, mark the type as explicitly nullable with the '?' sign in %sbug72119.php on line %d
19+
1820
Fatal error: Declaration of Hello::bar(array $baz = Array) must be compatible with Foo::bar(?array $baz = NULL) in %s on line %d

Zend/tests/ns_070.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Testing parameter type-hinted with default value inside namespace
66
namespace foo;
77

88
class bar {
9-
public function __construct(\stdclass $x = NULL) {
9+
public function __construct(?\stdclass $x = NULL) {
1010
var_dump($x);
1111
}
1212
}

Zend/tests/ns_071.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Testing parameter type-hinted (array) with default value inside namespace
66
namespace foo;
77

88
class bar {
9-
public function __construct(array $x = NULL) {
9+
public function __construct(?array $x = NULL) {
1010
var_dump($x);
1111
}
1212
}

Zend/tests/ns_072.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface foo {
1010
}
1111

1212
class bar {
13-
public function __construct(foo $x = NULL) {
13+
public function __construct(?foo $x = NULL) {
1414
var_dump($x);
1515
}
1616
}

Zend/tests/ns_073.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Testing type-hinted lambda parameter inside namespace
55

66
namespace foo;
77

8-
$x = function (\stdclass $x = NULL) {
8+
$x = function (?\stdclass $x = NULL) {
99
var_dump($x);
1010
};
1111

Zend/tests/ns_074.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Testing type-hinted lambda parameter inside namespace
55

66
namespace foo;
77

8-
$x = function (\stdclass $x = NULL) {
8+
$x = function (?\stdclass $x = NULL) {
99
var_dump($x);
1010
};
1111

Zend/tests/traits/bug60717.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace HTML
88
interface Helper
99
{
1010
function text($text);
11-
function attributes(array $attributes = null);
12-
function textArea(array $attributes = null, $value);
11+
function attributes(?array $attributes = null);
12+
function textArea(?array $attributes = null, $value);
1313
}
1414

1515
trait TextUTF8
@@ -19,14 +19,14 @@ namespace HTML
1919

2020
trait TextArea
2121
{
22-
function textArea(array $attributes = null, $value) {}
23-
abstract function attributes(array $attributes = null);
22+
function textArea(?array $attributes = null, $value) {}
23+
abstract function attributes(?array $attributes = null);
2424
abstract function text($text);
2525
}
2626

2727
trait HTMLAttributes
2828
{
29-
function attributes(array $attributes = null) { }
29+
function attributes(?array $attributes = null) { }
3030
abstract function text($text);
3131
}
3232

0 commit comments

Comments
 (0)