PHP Annotated – January 2020

栏目: IT技术 · 发布时间: 4年前

内容简介:Greetings everyone,It’s time for 2020’s first edition of PHP Annotated! This edition includes 4 new RFCs from PHP Internals and a few interesting updates for PHP 8 in pull-requests. We’ll catch up on the fresh releases from the end of 2019: Codeception 4.0

PHP Annotated – January 2020

Greetings everyone,

It’s time for 2020’s first edition of PHP Annotated! This edition includes 4 new RFCs from PHP Internals and a few interesting updates for PHP 8 in pull-requests. We’ll catch up on the fresh releases from the end of 2019: Codeception 4.0, Phalcon 4.0, CakePHP 4.0. We’ve also got articles on Laravel and Symfony, useful tools, videos, podcasts, and a whole lot more!

:zap:️ News & Releases

 PHP Internals

  • [RFC] Weak maps – This proposal has been accepted and merged into the PHP 8 branch.
  • [RFC] Variable Syntax Tweaks – This RFC proposes to fix some inconsistencies related to dereferencing that were not addressed in PHP 7 in the scope of the Uniform Variable Syntax RFC .
  • [RFC] Static return type – The static keyword in the context of type declaration refers to the late static binding . This document proposes to allow using static for return-type declarations for methods. This can be useful for static constructors and fluent interfaces.
    class Test {
        public function doWhatever(): static {
            // Do whatever.
            return $this;
        }
    }
     
    
    For properties and method parameters, however, this does not make sense and will not work.
  • [RFC] Allow ::class on objects – There’s a proposal to allow getting a fully qualified name from the class instance $object::class in PHP 8, in a way similar to how it now works for classes Foo\Bar::class .
  • [RFC] “use global functions/consts” statement – If a function or constant is used without a prefix, PHP will try to find it first in the current namespace and then in the global one. The author proposes to add the statements use global function , and use global consts

    , which will make the interpreter look first globally for functions and constants without a prefix.

    A few changes are available as pull-requests:

  • [PR] Deprecate required param after optional – This one will make PHP throw a deprecation notice when there is an optional parameter before a required one in the function signature
    function test(FooBar $param = null, $param2)
    This made sense when there were no nullable types, back before PHP 7.2. But it can now be converted to function test(?FooBar $param, $param2) .
  • [PR] Check abstract method signatures coming from traits – Signatures of abstract methods in traits are not validated with the ones implementing them, i.e. the following code now works without any errors:
    trait T {
        abstract function neededByTheTrait(int $a, string $b);
    }
    class C {
        use T;
        function neededByTheTrait(array $a, object $b) {}
    }
     
    
  • [PR] Ensure correct signatures for PHP magic methods – This pull request adds checks for magic methods signatures. At the moment, this only works as expected for __toString() and __clone() , and the following code, for example, does not show any error messages:
    class Foo {
    	function __get(int $name) {}
    }
     
    (new Foo)->{42};
     
    
  • [PR] Add Stringable interface – This PR introduces a new Stringable interface that ppl can declare when implementing __toString . The goal is to allow using the string|Stringable union type in PHP 8, to accept both strings and objects that implement __toString() .

 Tools

Symfony

Laravel

Zend/Laminas

Yii

 Async PHP

  • Screencast on DriftPHP , the async PHP framework built on top of ReactPHP Symfony components.
  • amphp/http-client 4.0 – The updated HTTP client from Amphp now has full HTTP/2 support and many other improvements. Also, when running on PHP 7.4 you can install nghttp2 , which will be used via FFI.

 Misc

 Videos

 Podcasts

Thanks for reading!

If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post, or tweet me .

Subscribe to PHP Annotated

Your JetBrains PhpStorm Team

The Drive to Develop


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

逆向工程权威指南

逆向工程权威指南

Dennis Yurichev(丹尼斯) / 安天安全研究与应急处理中心 / 人民邮电出版社 / 2017-3-1 / 168

逆向工程是一种分析目标系统的过程,旨在于识别系统的各组件以及组件间关系,以便于通过其它形式、或在较高的抽象层次上,重建系统的表征。 本书专注于软件的逆向工程,是写给初学者的一本经典指南。全书共分为12个部分,共102章,涉及X86/X64、ARM/ARM-64、MIPS、Java/JVM等重要话题,详细解析了Oracle RDBMS、Itanium、软件狗、LD_PRELOAD、栈溢出、EL......一起来看看 《逆向工程权威指南》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试