
Nova seleção com links para notícias e materiais. No lançamento: Enum no PHP 8.1, remoção serializável e limitação de $ GLOBALS, além de outras notícias do PHP Internals, PhpStorm 2020.3, Symfony UX, uma porção de ferramentas úteis, um vídeo e o primeiro fluxo de resumo do PHP.
Gostar de ler!
Notícias e lançamentos
PhpStorm 2020.3 : PHP 8, Atributos, PHPStan e Psalm, Xdebug 3, Tailwind CSS e Co-desenvolvimento.
- JetBrains Qodana EAP — JetBrains PhpStorm CI.
- Slack $27 — , PHP, Hack.
- WordPress 5.6 — C - PHP 8.
- PHP – 2020.2 — , Composer packagist.org.
• PHP 7.4: 42.61% (+22.55)
• PHP 7.3: 27.05% (-3.00)
• PHP 7.2: 15.28% (-12.21)
• PHP 7.1: 7.45% (-4.1)
• PHP 5.6: 2.71% (-2.28)
• PHP 7.0: 2.70% (-1.30)
PHP Internals
- [RFC] Deprecate passing null to non-nullable arguments of internal functions — PHP
null
,nullable
. ,str_contains("", null)
, , null .
str_contains("", null); // > No errors function _str_contains ( string $haystack , string $needle ) : bool { return true; } _str_contains("", null); // > Fatal error: Uncaught TypeError: Argument 2 passed to _str_contains() must be of the type string, null given
8.1 deprecation notice.
declare(strict_types=1);
. - [RFC] Restrict $GLOBALS usage — ,
$GLOBALS
,INDIRECT
PHP. PHP.
RFC$GLOBALS
.
, , isset unset:
$GLOBALS['x'] = 1; echo $GLOBALS['x'] isset($GLOBALS['x']); unset($GLOBALS['x']);
.
$GLOBALS :
$GLOBALS = []; $GLOBALS =& $x; $x =& $GLOBALS; unset($GLOBALS);
,$GLOBALS
:
asort($GLOBALS); // > Compile-time error
: : « PHP».
- [RFC] Phasing out Serializable — 7.4 :
Serialiazable
__serialize()
__unserialize()
.
Serializable
. PHP 8.1 deprecation notice, PHP 9.0 — compile-time error. - [RFC] Enumerations — Ilija Tovilo Larry Garfield enum RFC, Swift, Rust, Kotlin.
Enum , — . , , « Enums X» « , ». .
enum
case
:
enum Suit { case Hearts; case Diamonds; case Clubs; case Spades; }
:
$val = Suit::Diamonds; function pick_a_card(Suit $suit) { ... } pick_a_card($val); // OK pick_a_card(Suit::Clubs); // OK pick_a_card('Spades'); // TypeError
Enum -:
$a = Suit::Spades; $b = Suit::Spades; $a === $b; // true $a instanceof Suit; // true $a instanceof Suit::Spades; // true
Enum. , :
enum Suit: string { case Hearts = 'H'; case Diamonds = 'D'; case Clubs = 'C'; case Spades = 'S'; } echo "I hope I draw a " . Suit::Spades; // prints "I hope I draw a S".
Enum , . :
enum UserStatus: string { case Pending = 'pending'; case Active = 'active'; case Suspended = 'suspended'; case CanceledByUser = 'canceled'; public function label(): string { return match($this) { UserStatus::Pending => 'Pending', UserStatus::Active => 'Active', UserStatus::Suspended => 'Suspended', UserStatus::CanceledByUser => 'Canceled by user', }; } } foreach (UserStatus::cases() as $key => $val) { printf('<option value="%s">%s</option>\n', $key, $val->label()); }
:
- case?
- ?
function stuff(Suit::Heart|Suit:Diamond $card) { ... }
- Enum?
- <
enum
? ,Enum
. :enum class UserStatus {...}
- [RFC] Algebraic Data Types — Enum PHP. ** tagged unions pattern matching.
- [RFC] Direct execution opcode file without php source code file — . , -
.pyc / .pyo
.
PHP . ,<?phpo%php_version_id%
.
include()
,include_once()
,require()
,require_once()
. - [RFC] Wall-Clock Time Based Execution Timeout — PHP . sleep() . , ini-
max_execution_time
.
RFCmax_execution_wall_time
, .
- itsgoingd/clockwork v5.0 — Chrome, dev tools PHP-.
PHP.
- nicofff/LazyIter — . Rust. .
- veewee/composer-run-parallel — «scripts» composer.json.
- clue/phar-composer — composer.json phar .
- clue/commander — .
- quasilyte/phpgrep 1.0 — PHP- – grep, «» PHP.
Symfony
- Symfony UX — Symfony - npm, Webpack Encore Stimulus js. PHP+JS , Composer: symfony/ux.
- Symfony #728 (7-13 2020)
- Action-Domain-Responder Symfony
- Symfony
Symfony Workshop 2020 — Symfony.
Laravel
- Laravel Sail — CLI- Laravel- Docker.
- tailflow/laravel-orion 1.0 — REST API Eloquent- .
- asantibanez/laravel-eloquent-state-machines — ( ) Eloquent . , .
- lukeraymonddowning/honey — - .
October CMS Laravel 6?
Laravel Internals #2 — Laravel.
Laravel at Scale: Framework, Community & Ecosystem — .
Laravel– (6–13 2020)
Yii
- Yii 1.1.23 — C PHP 8.
- yiisoft/cookies — Yii 3. - PSR-7.
SOLID . - ActiveQuery Yii2
Async PHP
- clue/reactphp-zenity — Zenity GUI PHP. Ubuntu.
- PHP- — Wikipedia, : wikimedia/php-excimer – wikimedia/arc-lamp – -.
We ingest about 3 million samples daily from a cluster of 150 Apache servers in any given data centre, using a 60s sample interval. These are all received by a single Redis instance.
- AWS Lambda PHP, Docker
- Travis CI GitHub Actions — , Travis CI .
- php.watch: JIT PHP 8
- Faker 2.0 — Faker . Faker.
- PHP Zend
: gRPC- PHP
C++, JS, Python, Python + numba, PHP7, PHP8, Golang “ ”
Telegram , 1
: ,
MySQL Slack Vitess
«PHP » Matthias Noback . — lex111, PHP.
/
PHP 6.5
Introdução ao PHP | Aprenda PHP da maneira certa - outro curso em vídeo para iniciantes.
Curso de vídeo OOP em PHP para iniciantes
Escrevendo um blog em PHP - e mais para iniciantes.
- O que há de novo no PHP 8.0 - Uma análise detalhada do que há de novo no PHP.
Divertido
- Novo elefante do 15º aniversário da Symfony disponível para venda
Hoje vou transmitir o resumo do PHP pela primeira vez. Todas as notícias e links da edição + mais detalhes, uma visão geral do que foi enviado, interessante mas não incluído na edição, e um concurso com elefantes.
Começando às 20:00 Moscou, Minsk / 19:00 Kiev.
Se você notar um erro ou imprecisão, informe-nos por meio de um habr ou telegrama pessoal .
Mais notícias e comentários no canal PHP Digest Telegram .
Enviar link
Links de busca em todos os resumos
← Número anterior: PHP-Digest # 193