Durante estas dos semanas del núcleo, el equipo de PHP discutió activamente la propuesta de Aplicación de función parcial y, como alternativa, Nikita Popov sugirió una sintaxis más simple para obtener un enlace a cualquier función. También se propone agregar propiedades estáticas a las enumeraciones ya adoptadas en PHP 8.1.
Symfony 6 requerirá PHP 8.0, y el Doctrine 2.9 publicado admite la especificación de metadatos en atributos en lugar de PHPDoc.
También en el lanzamiento hay un artículo interesante sobre expresiones regulares e instrucciones para usar Deployer, así como otros artículos útiles, un paquete de herramientas, algunos videos y podcasts.
¡Disfruta leyendo!
Internos de PHP
[RFC] Sintaxis invocable de primera clase
[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 . .
/
- Pruebas de mutación: cómo ayudará y cómo usarlo mejor - Entrevista con Max Rafalko en vísperas de PHP Rusia .
Suscríbase al canal PHP Digest Telegram .
Si te gustó el resumen, dale un plus; esto es muy motivador para seguir haciéndolo.
¿Detectó un error o un error tipográfico? Informar en un habr personal o telegrama .
Puede enviar un enlace a través del formulario o simplemente escribiéndome en un telegrama .
Buscar enlaces en todos los resúmenes
← Número anterior: PHP-Digest # 203