Fresh selection with links to news and materials. In the release: the PEAR repository is hacked, the future of Xdebug, the PHP Russia 2019 conference, the latest releases, RFC offers from PHP Internals, a portion of useful tools, and much more.
Enjoy reading!
??=
finally finished and completed. Despite the seeming simplicity of the task, the implementation was very nontrivial .$a ??= $b
equivalent to $a ?? ($a = $b)
$a ?? ($a = $b)
. In the case of $a[foo()] ??= bar()
function foo()
will be called exactly once, and bar()
will be called if $a[foo()]
is null
(or not set). // Returns array containing all the necessary state of the object. public function __serialize(): array; // Restores the object state from the given data array. public function __unserialize(array $data): void;
Serialiazable
interface Serialiazable
. Unfortunately, the interface itself cannot be corrected, but if the proposal is adopted, there will be a working alternative. class MotorCycle { public $vendor; public $cc; public $whells = 2; public function __construct($vendor, $cc) { $this->vendor = $vendor; $this->cc = $cc; } //other methods } class MyCustomMotorCycle extends MotorCycle { public function __construct($cc, $whells) { parent::__construct("Custom", $cc); // $this->cc = $cc; this statement will be added within proposed realisation $this->whells = $whells; } }
class MotorCycle($vendor, $cc){ public $whells = 2; //other methods }; class MyCustomMotorCycle($cc, $whells) extends MotorCycle("Custom", $cc){ };
Thanks for attention!
If you notice an error or inaccuracy - please inform the PM .
Write questions and suggestions by mail or twitter .
More news and comments on the PHP Digest Telegram channel.
Send link
Search links for all digests
← Previous release: PHP Digest number 147
Source: https://habr.com/ru/post/437752/