PHP文摘第148号(2019年1月14日至28日)


带有新闻和资料链接的新鲜选择。 问题:破解了PEAR存储库,关于Xdebug的未来,PHP Russia 2019会议,最新版本,PHP Internals的RFC提供的内容,有用的工具的一部分等等。

祝您阅读愉快!



新闻与发布



PHP内部


  • [RFC]空合并分配运算符 -提案已于两年前被接受。 现在,最终完成并呈现了带有检查null ??=的组合运算符的实现。 尽管任务看起来很简单,但是实现起来却是非常简单的
    总计: $a ??= $b等效于$a ?? ($a = $b) $a ?? ($a = $b) 。 在$a[foo()] ??= bar()函数foo()将被精确调用一次,而$a[foo()]null (或未设置)则将调用bar() )。
    该主题是有关PHP中其他短运算符的好文章。
  • [RFC]新的自定义对象序列化机制 -Nikita Popov提供的最新RFC。 建议通过添加一些魔术方法来引入一种用于序列化对象的新机制:

     // 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接口Serialiazable 。 不幸的是,无法修复接口本身,但是如果提案被接受,将有可行的替代方案。
  • [RFC]无代码构造函数 -建议添加一个自动构造函数,其任务是初始化属性:
    隐藏文字
     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){ }; 


工具



Symfony



拉拉韦尔



异步php



内容管理系统



学习资料




娱乐性


  • 代码星系 -对Composer软件包之间的关系进行有趣的3D可视化。

感谢您的关注!

如果您发现错误或不准确,请在PM中通知我。
问题和建议写在邮件推特上

有关PHP Digest Telegram Channel的更多新闻和评论。

发送链接
搜索所有摘要的链接
先前版本:PHP文摘147号

Source: https://habr.com/ru/post/zh-CN437752/


All Articles