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


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

查看所有标签

猜你喜欢:

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

形式感+:网页视觉设计创意拓展与快速表现

形式感+:网页视觉设计创意拓展与快速表现

晋小彦 / 清华大学出版社 / 2014-1-1 / 59.00元

网页设计师从早年的综合性工作中分化出来,形成了相对独立的专业岗位,网页设计也不再是单纯的软件应用,它衍生出了许多独立的研究方向,当网站策划、交互体验都逐渐独立之后,形式感的突破和表现成为网页视觉设计的一项重要工作。随着时代的发展,网页设计更接近于一门艺术。网络带宽和硬件的发展为网页提供了使用更大图片、动画甚至视频的权利,而这些也为视觉设计师提供了更多表现的空间。另外多终端用户屏幕(主要是各种移动设......一起来看看 《形式感+:网页视觉设计创意拓展与快速表现》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具