Au cours de ces deux semaines de noyau, l'équipe PHP a activement discuté de la proposition d'application de fonction partielle et, comme alternative, Nikita Popov a suggéré une syntaxe plus simple pour obtenir un lien vers n'importe quelle fonction. Il est également proposé d'ajouter des propriétés statiques aux énumérations déjà adoptées en PHP 8.1.
Symfony 6 nécessitera PHP 8.0, et la Doctrine 2.9 publiée prend en charge la spécification de métadonnées dans les attributs au lieu de PHPDoc.
Le communiqué contient également un article intéressant sur les expressions régulières et les instructions d'utilisation de Deployer, ainsi que d'autres articles utiles, un ensemble d'outils, des vidéos et des podcasts.
Bonne lecture!
Internes PHP
[RFC] Syntaxe appelable de première 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 . .
/
Test de mutation : comment ça va aider et comment mieux l'utiliser - Entretien avec Max Rafalko à la veille de PHP Russie .
Abonnez-vous à la chaîne PHP Digest Telegram .
Si vous avez aimé le condensé, donnez-lui un plus - c'est très motivant de continuer à le faire.
Avez-vous repéré une erreur ou une faute de frappe? Informer dans un habr ou un télégramme personnel .
Vous pouvez envoyer un lien via le formulaire ou simplement en m'écrivant par télégramme .
Rechercher des liens dans tous les résumés
← Numéro précédent : PHP-Digest # 203