PHP文摘第176号(2020年3月11日至23日)


带有新闻和资料链接的新鲜选择。在发行版中:PHP和Composer 1.10更新,会议转移,PHP Internals提供的3个新RFC提供,一部分有用的工具,视频,播客等等。

享受阅读!



新闻与发布



PHP Internals


  • [RFC] str_contains. str_contains() , .
  • [RFC] throw expression — PHP , throw – , . , :
    $callable = fn() => throw new Exception();
    
    $value = $nullableValue ?? throw new InvalidArgumentException();
    
    $value = $falsableValue ?: throw new InvalidArgumentException();
    
    $value = !empty($array)
                ? reset($array)
                : throw new InvalidArgumentException();
  • [RFC] Compact Object Property Assignment — . [RFC] Object Initializer, . :
    doTheFoo((new Foo)->[
        a = 1,
        b = 2,
        c = 3,
    ]);
    
    // :
    
    $myObj = new Foo();
    
    $myObj->a = 1;
    $myObj->b = 2;
    $myObj->c = 3;
    
    doTheFoo($myObj);
  • [RFC] Is Literal Checkis_literal(), / , , , PHP, .
    define('TABLE', 'example');
    
    $sql = 'SELECT * FROM ' . TABLE . ' WHERE id = ?';
    
    is_literal($sql); // Returns true
    
    $sql .= ' AND id = ' . mysqli_real_escape_string($db, $_GET['id']);
    
    is_literal($sql); // Returns false
    

    , . , .
  • [RFC] Write-Once Properties — , . , , , .
  • RFC .
    .
    Understanding RFC attitudes , - , - , PHP Internals RFC.



Symfony



Laravel



Async PHP





/



感谢您的关注!

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

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

发送链接
搜索所有摘要的链接
上一版本:PHP摘要175


All Articles