Re: [VOTE] Alternative typehinting syntax for accessors
Hello Nikita,
for me this "maybe-of-type"-typehinting is a small progression in the right
direction.
But "Default values and nullability" would break existing code as you need
to add a default null at "design-time" (BC break):
<?php
class C {
public $a; // public string $a = null;
public $b; // public string $b = null;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
}
// test only a
$c = new C("foo", null);
var_dump($c->a === "foo");
// test only b
$c = new C(null, "foo");
var_dump($c->b === "foo");
?>
http://3v4l.org/4oi9k
cryptocompress
Thread (11 messages)