Durante essas duas semanas do nĂșcleo, a equipe do PHP discutiu ativamente a proposta do Aplicativo de função parcial e, como alternativa, Nikita Popov sugeriu uma sintaxe mais simples para obter um link para qualquer função. TambĂ©m Ă© proposto adicionar propriedades estĂĄticas aos enums jĂĄ adotados no PHP 8.1.
Symfony 6 exigirå PHP 8.0, e o Doctrine 2.9 lançado suporta a especificação de metadados em atributos ao invés de PHPDoc.
TambĂ©m no lançamento estĂĄ um artigo legal sobre regexps e instruçÔes para usar o Deployer, bem como outros artigos Ășteis, um pacote de ferramentas, alguns vĂdeos e podcasts.
Gostar de ler!
PHP Internals
[RFC] Sintaxe chamĂĄvel de primeira classe
[RFC] Partial Function Application .
// $fn = Closure::fromCallable('strlen'); $fn = Closure::fromCallable([$this, 'method']); $fn = Closure::fromCallable([Foo::class, 'method']); // $fn = strlen(...); $fn = $this->method(...); $fn = Foo::method(...);
, ,callable
. , :
array_map(Something::toString(...), [1, 2, 3]); array_map(strval(...), [1, 2, 3]); // array_map([Something::class, 'toString'], [1, 2, 3]) array_map('strval', [1, 2, 3]);
[RFC] Disable autovivification on false
PHPnull
false
.false
-Fatal error
:
3v4l.org/UucOC$a = true; $a[] = 'value'; // Fatal error: Uncaught Error: Cannot use a scalar value as an array $a = null; $a[] = 'value'; // Ok $a = false; $a[] = 'value'; // ,
[RFC] Allow static properties in enums
PHP 8.1 .
PHP- php.watch.
, .
enum Environment { case DEV; case STAGE; case PROD; private static Environment $currentEnvironment; /** * Read the current environment from a file on disk, once. * This will affect various parts of the application. */ public static function current(): Environment { if (!isset(self::$currentEnvironment)) { $info = json_decode(file_get_contents(__DIR__ . '/../../config.json'), true); self::$currentEnvironment = match($info['env']) { 'dev' => self::DEV, 'stage' => self::STAGE, 'prod' => self::PROD, }; } return self::$currentEnvironment; } // Other methods can also access self::$currentEnvironment } printf("Current environment is %s\n", Environment::current()->name);
. , .
, PhpStorm 2021.2enum
, 2021.2 EAP.
[PR] HTTP Early Hint support
, PHP .HTTP 1xx
. ,103
, Link, , ,200 OK
.
, :103
, ,header()
, âecho
.
, . - API Symfony HTTP.
[RFC] Add IntlDatePatternGenerator
. PHP 8.1IntlDatePatternGenerator
. PHP Internals News #85 RFC.
[RFC] Final class constants
.
Internals bugs.php.net
issues GitHub. , . , . PHP, issue php/doc-en php/doc-ru. .
- Doctrine ORM 2.9 â ORM. PHP 8, , .
- Flarum 1.0.0 â PHP.
- moneyphp/money 4.0 â .
- phpast.com â PHP. nikic/PHP-Parser. : ryangjchandler/phpast.com.
- JBZoo/CI-Report-Converter â CI. â CI (TeamCity, GitHub Actions, etc). smetdenis.
- veewee/xml â XML .
Symfony
- Symfony.
- Symfony 5.3.
- Symfony 6 PHP 8.0 â , .
Laravel
Tinker.
Laravel Jetstream.
«One of Many».
Laravel Octane with Swoole â Beyond the Basics â Laravel core .
- PHP.Watch: PHP.
- Deployer GitHub Actions â deployphp/deployer .
- PHP â .
copy-on-write PHP.
Dependency Injection Software Engineering.
( ).
PHP 35 ?
DTO yzen-dev/plain-to-class.
https://github.com/alexpts/php-data-transformer2 dto dto . .
/
Teste de mutação: como vai ajudar e como usĂĄ-lo melhor - Entrevista com Max Rafalko Ă s vĂ©speras do PHP RĂșssia .
Inscreva-se no canal PHP Digest Telegram .
Se vocĂȘ gostou do resumo, dĂȘ um acrĂ©scimo - Ă© muito motivador continuar fazendo isso.
VocĂȘ identificou um erro ou erro de digitação? Informe em um habr ou telegrama pessoal .
VocĂȘ pode enviar um link pelo formulĂĄrio ou simplesmente me escrevendo em um telegrama .
Pesquisar links em todos os resumos
â NĂșmero anterior: PHP-Digest # 203