{"id":245013,"date":"2022-05-06T10:06:25","date_gmt":"2022-05-06T09:06:25","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=phpstorm&#038;p=245013"},"modified":"2022-08-09T17:14:50","modified_gmt":"2022-08-09T16:14:50","slug":"php-annotated-2022-spring-catch-up","status":"publish","type":"phpstorm","link":"https:\/\/blog.jetbrains.com\/phpstorm\/2022\/05\/php-annotated-2022-spring-catch-up\/","title":{"rendered":"PHP Annotated \u2014 2022 Spring Catch-up"},"content":{"rendered":"<p><a href=\"https:\/\/blog.jetbrains.com\/phpstorm\/2022\/05\/php-annotated--2022-spring-catch-up\/\"><img decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2020\/01\/phpstorm-PHP_Annotated_blog_1600x800.png\" alt=\"PHP Annotated Monthly\" width=\"800\"><\/a><\/p>\n<p>Greetings everyone,<\/p>\n<p>It has been a while since the PHP Annotated <del>Monthly<\/del> was online, so hopefully we are back on track. With <a href=\"https:\/\/twitter.com\/brendt_gd\" target=\"_blank\" rel=\"noopener\">Brent<\/a> joining the PhpStorm team we want to experiment with some new things, so stay tuned!<\/p>\n<p>In this edition, we\u2019ll catch up on the most interesting things that have happened in the PHP world over the last couple of months. As always, it includes curated news, articles, tools, and videos.<\/p>\n<p><!--more--><\/p>\n<style>img.alignico {margin-right: 10px;margin-top: 5px;float: left;}  main ul:not([class]):not([id]) li, main .article-section .content ul:not([class]):not([id]) > li {padding-bottom: 12px;}  summary {display: list-item;cursor: pointer;font-style: italic;}<\/style>\n<h2 id=\"news\">News<\/h2>\n<ul>\n<li><strong><a href=\"https:\/\/www.php.net\/ChangeLog-7.php#7.4.29\" target=\"_blank\" rel=\"noopener\">PHP 7.4.29<\/a>, <a href=\"https:\/\/www.php.net\/ChangeLog-8.php#8.1.5\" target=\"_blank\" rel=\"noopener\">PHP 8.1.5<\/a>, and <a href=\"https:\/\/www.php.net\/ChangeLog-8.php#8.0.18\" target=\"_blank\" rel=\"noopener\">PHP 8.0.18<\/a><\/strong><br \/>\nThese are security releases for Windows users, due to updates of built-in dependencies. For non-Windows users, they are just regular bug-fix updates.For PHP 7.3, updates <a href=\"https:\/\/www.php.net\/supported-versions.php\" target=\"_blank\" rel=\"noopener\">are no longer released<\/a>, even for security problems. If you are still using PHP 7.3 or PHP 5.x versions, consider updating as soon as possible.<\/p>\n<p>The Symfony team has <a href=\"https:\/\/github.com\/symfony\/symfony\/pull\/45377\" target=\"_blank\" rel=\"noopener\">raised<\/a> its minimum required PHP version to 8.1 in the upcoming Symfony 6.1 release. The same shift was made for <a href=\"https:\/\/www.drupal.org\/node\/3264830\" target=\"_blank\" rel=\"noopener\">Drupal 10<\/a> and <a href=\"https:\/\/github.com\/laravel\/framework\/pull\/41250\" target=\"_blank\" rel=\"noopener\">Laravel 10<\/a>.<\/p>\n<p>Also, the recently released <a href=\"https:\/\/linuxconfig.org\/ubuntu-22-04-features-and-release-date\" target=\"_blank\" rel=\"noopener\">Ubuntu 22.04 LTS<\/a> comes with PHP 8.1 preinstalled.<\/li>\n<li><strong>Updates from <a href=\"https:\/\/opencollective.com\/phpfoundation\" target=\"_blank\" rel=\"noopener\">the PHP Foundation<\/a><\/strong>\n<ul>\n<li><a href=\"https:\/\/opencollective.com\/phpfoundation\/updates\/the-php-foundation-update-march-2022\" target=\"_blank\" rel=\"noopener\">Six sponsored developers<\/a> are actively working on maintaining the core.<\/li>\n<li>The <a href=\"https:\/\/thephp.foundation\/\" target=\"_blank\" rel=\"noopener\">thephp.foundation<\/a> website is up and running.<\/li>\n<li>A separate newsletter with insights about core developments will be published regularly. Here\u2019s the first edition: <a href=\"https:\/\/thephp.foundation\/blog\/2022\/04\/28\/php-roundup-1\/\" target=\"_blank\" rel=\"noopener\">PHP Roundup #1<\/a>.<\/li>\n<li><a href=\"https:\/\/thephp.foundation\/blog\/2022\/05\/06\/interview-with-core-developers\/\" target=\"_blank\" rel=\"noopener\">Interview with Core Developers<\/a> by Sebastian Bergmann.<\/li>\n<\/ul>\n<\/li>\n<li><strong><a href=\"https:\/\/surveys.jetbrains.com\/s3\/t-developer-ecosystem-survey-2022\" target=\"_blank\" rel=\"noopener\">Developer Ecosystem Survey 2022<\/a><\/strong><br \/>\nThe annual survey from JetBrains is now open and, of course, there is a section about PHP. This is what the <a href=\"https:\/\/www.jetbrains.com\/lp\/devecosystem-2021\/php\/\" target=\"_blank\" rel=\"noopener\">results from last year<\/a> look like. Take the survey for a chance to win one of the prizes!<\/li>\n<li><strong>News from PHP-FIG<\/strong>\n<ul>\n<li><a href=\"https:\/\/github.com\/php-fig\/per-coding-style\" target=\"_blank\" rel=\"noopener\">Coding Style PER (PHP Evolving Recommendation)<\/a> has been officially approved by PHP-FIG and will replace PSR-12. This is the first <a href=\"https:\/\/www.php-fig.org\/bylaws\/per-workflow\/\" target=\"_blank\" rel=\"noopener\">PER<\/a> document showing the &#8220;live&#8221; standard. Thanks to PERs, there will be no need to release another PSR standard every time new syntax is added to PHP. Instead, PERs will be updated according to <a href=\"https:\/\/semver.org\/lang\/ru\/\" target=\"_blank\" rel=\"noopener\">SemVer<\/a>.<\/li>\n<li>A new PSR draft has been approved: <a href=\"https:\/\/github.com\/php-fig\/fig-standards\/blob\/master\/proposed\/tracing.md\" target=\"_blank\" rel=\"noopener\">PSR-22 \u2013 Application Tracing<\/a>.<\/li>\n<\/ul>\n<\/li>\n<li><strong><a href=\"https:\/\/blog.jetbrains.com\/phpstorm\/2022\/04\/phpstorm-2022-1-release\/\">PhpStorm 2022.1 released<\/a><\/strong><br \/>\nIt comes with improvements for Blade, WordPress, ArrayShape annotations, and many more. Check out a short <a href=\"https:\/\/www.youtube.com\/watch?v=gqck6bJ1JWo\" target=\"_blank\" rel=\"noopener\">What&#8217;s New<\/a> video or read the <a href=\"https:\/\/blog.jetbrains.com\/phpstorm\/2022\/04\/phpstorm-2022-1-release\/\">blog post<\/a> for the full story.<\/li>\n<li><strong><a href=\"https:\/\/blog.packagist.com\/composer-2-3\/\" target=\"_blank\" rel=\"noopener\">Composer 2.3 Release<\/a><\/strong><br \/>\nThis release brings small improvements for users and a modernized internal codebase.<\/p>\n<p>There was also a vulnerability discovered recently \u2013 <a href=\"https:\/\/blog.packagist.com\/cve-2022-24828-composer-command-injection-vulnerability\/\" target=\"_blank\" rel=\"noopener\">CVE-2022-24828: Composer Command Injection<\/a>. An attacker controlling a Git or Mercurial repository explicitly listed by URL in <code>composer.json<\/code> could use specially crafted branch names to execute commands on the machine running the composer update.<\/p>\n<p>Make sure your Composer is up-to-date by running <code>composer self-update<\/code>.<\/li>\n<li><strong><a href=\"https:\/\/craftcms.com\/blog\/craft-4?ref=phpannotated\" target=\"_blank\" rel=\"noopener\">Craft CMS 4<\/a><\/strong><br \/>\nA major update of the popular <a href=\"https:\/\/github.com\/craftcms\/cms\" target=\"_blank\" rel=\"noopener\">open-source<\/a> CMS was released.<\/li>\n<\/ul>\n<h2 id=\"php_core\">PHP Core<\/h2>\n<p>Most of the Core news is covered in detail in the <a href=\"https:\/\/thephp.foundation\/blog\/2022\/04\/28\/php-roundup-1\/\" target=\"_blank\" rel=\"noopener\">PHP Roundup series<\/a> from the PHP Foundation, so we&#8217;ll only mention them briefly.<\/p>\n<ul>\n<li><a href=\"https:\/\/externals.io\/message\/117595#117664\" target=\"_blank\" rel=\"noopener\"><strong>Last call for PHP 8.2 release managers!<\/strong><\/a><br \/>\nYou need to be able to commit to a 3\u00bd-year term, and have good knowledge of PHP, Git, and preferably C. There are <a href=\"https:\/\/wiki.php.net\/todo\/php82#volunteers\" target=\"_blank\" rel=\"noopener\">already<\/a> one veteran and six rookie candidates.<\/li>\n<li>&#x2705; <a href=\"https:\/\/wiki.php.net\/rfc\/redact_parameters_in_back_traces\" target=\"_blank\" rel=\"noopener\">[RFC] Redacting parameters in back traces<\/a> #PHP8.2<\/li>\n<li>&#x2705; <a href=\"https:\/\/wiki.php.net\/rfc\/null-false-standalone-types\" target=\"_blank\" rel=\"noopener\">[RFC] Allow null and false as stand-alone types<\/a> #PHP8.2<\/li>\n<li>&#x2705; <a href=\"https:\/\/wiki.php.net\/rfc\/deprecate_dollar_brace_string_interpolation\" target=\"_blank\" rel=\"noopener\">[RFC] Deprecate ${} string interpolation<\/a> #PHP8.2<\/li>\n<li>&#x2705; <a href=\"https:\/\/wiki.php.net\/rfc\/remove_utf8_decode_and_utf8_encode\" target=\"_blank\" rel=\"noopener\">[RFC] Deprecate and Remove utf8_encode and utf8_decode<\/a><\/li>\n<li>&#x2705; <a href=\"https:\/\/wiki.php.net\/rfc\/undefined_variable_error_promotion\" target=\"_blank\" rel=\"noopener\">[RFC] Undefined Variable Error Promotion<\/a><\/li>\n<li>&#x1f5f3; <a href=\"https:\/\/wiki.php.net\/rfc\/readonly_classes\" target=\"_blank\" rel=\"noopener\">[RFC] Readonly classes<\/a><\/li>\n<li>&#x274c; <a href=\"https:\/\/wiki.php.net\/rfc\/sealed_classes\" target=\"_blank\" rel=\"noopener\">[RFC] Sealed Classes<\/a><\/li>\n<li>&#x1f195; <a href=\"https:\/\/wiki.php.net\/rfc\/true-type\" target=\"_blank\" rel=\"noopener\">[RFC] Add true type<\/a><\/li>\n<li>&#x1f195; <a href=\"https:\/\/wiki.php.net\/rfc\/dnf_types\" target=\"_blank\" rel=\"noopener\">[RFC] Disjunctive Normal Form Types<\/a><\/li>\n<li><a href=\"https:\/\/wiki.php.net\/rfc\/deque\" target=\"_blank\" rel=\"noopener\">[RFC] final class Collections\\Deque<\/a><br \/>\nAs part of an initiative to add optimized data structures to PHP, the first proposal is ready.<br \/>\n<code>Deque<\/code> \u2013 This is a two-way queue, i.e. items can be added and removed both at the beginning and at the end. It can be used instead of <code>SplQueue<\/code> or <code>SplDoublyLinkedList<\/code> to get a performance gain and reduce memory consumption.<\/li>\n<li><a href=\"https:\/\/gist.github.com\/cspray\/0f4e67e8731a8ea9382147707e75287f\" target=\"_blank\" rel=\"noopener\">RFC Introduce a class-string type<\/a><br \/>\nIt\u2019s not an official RFC, but an interesting idea to make class-string a real type, as it&#8217;s already widely used in static analyzers&#8217; annotations.<\/li>\n<\/ul>\n<h2 id=\"tools\">Tools<\/h2>\n<ul>\n<li><a href=\"https:\/\/caniphp.com\/\" target=\"_blank\" rel=\"noopener\">CanIPHP.com<\/a> \u2013 It&#8217;s like caniuse.com, but for PHP features.<\/li>\n<li><a href=\"https:\/\/github.com\/clue\/stream-filter\" target=\"_blank\" rel=\"noopener\">clue\/stream-filter<\/a> \u2013 A simple and modern approach to stream filtering in PHP. You can do some <a href=\"https:\/\/github.com\/jaem3l\/unfuck\" target=\"_blank\" rel=\"noopener\">crazy stuff<\/a> with stream filters in PHP, but also <a href=\"https:\/\/github.com\/dg\/bypass-finals\" target=\"_blank\" rel=\"noopener\">practical things<\/a>, too.<\/li>\n<li><a href=\"https:\/\/github.com\/sfx101\/deck\" target=\"_blank\" rel=\"noopener\">sfx101\/deck<\/a> \u2013 A GUI tool for quick spin-up and configuration of local web development environments, which could be useful for PHP newcomers.<\/li>\n<li><a href=\"https:\/\/github.com\/marijnvanwezel\/try\" target=\"_blank\" rel=\"noopener\">marijnvanwezel\/try<\/a> \u2013 A simple CLI tool to try Composer packages with a single command. Just install it and run: <code>try %vendor%\/%package%<\/code>.<\/li>\n<li><a href=\"https:\/\/github.com\/frodeborli\/moebius\" target=\"_blank\" rel=\"noopener\">frodeborli\/moebius<\/a> \u2013 Golang-like coroutines for PHP versions 8.1 or above. The author used his own event-loop implementation, and even a custom testing framework.<\/li>\n<li><a href=\"https:\/\/github.com\/Crell\/AttributeUtils\" target=\"_blank\" rel=\"noopener\">Crell\/AttributeUtils<\/a> \u2014 Utilities to help ease the parsing and managing of attributes. You might be also interested in <a href=\"https:\/\/github.com\/koriym\/Koriym.Attributes\" target=\"_blank\" rel=\"noopener\">koriym\/Koriym.Attributes<\/a>, which can read both doctrine\/annotations and PHP 8 attributes with a doctrine annotation interface.<\/li>\n<li><a href=\"https:\/\/github.com\/spatie\/visit\" target=\"_blank\" rel=\"noopener\">spatie\/visit<\/a> \u2013 A CLI HTTP client that shows responses of any URL in a beautiful way.<\/li>\n<li><a href=\"https:\/\/github.com\/laravel\/valet\" target=\"_blank\" rel=\"noopener\">laravel\/valet<\/a> \u2013 A lightweight local dev environment for Mac. No Docker or VirtualBox, just native Nginx and PHP. It can be used for any projects, not only Laravel, and since v3 you can use <a href=\"https:\/\/laravel.com\/docs\/9.x\/valet#per-site-php-versions\" target=\"_blank\" rel=\"noopener\">different PHP versions<\/a> for each folder (project).<\/li>\n<li><a href=\"https:\/\/github.com\/roach-php\/core\" target=\"_blank\" rel=\"noopener\">roach-php\/core<\/a> \u2013 The complete web scraping toolkit for PHP.<\/li>\n<li><a href=\"https:\/\/phpstan.org\/blog\/phpstan-1-6-0-with-conditional-return-types\" target=\"_blank\" rel=\"noopener\">PHPStan 1.6.0<\/a> \u2013 Released with support for conditional return types and integer masks.<\/li>\n<li><a href=\"https:\/\/github.com\/flow-php\/etl\" target=\"_blank\" rel=\"noopener\">flow-php\/etl<\/a> \u2013 An ETL (Extract Transform Load) data processing library for PHP with support for async processing via ReactPHP or Amphp.<\/li>\n<li><a href=\"https:\/\/github.com\/igorhrcek\/wp-cli-secure-command\/\" target=\"_blank\" rel=\"noopener\">igorhrcek\/wp-cli-secure-command<\/a> \u2013 One CLI command to secure your WordPress installation.<\/li>\n<li><a href=\"https:\/\/github.com\/williarin\/wordpress-interop\" target=\"_blank\" rel=\"noopener\">williarin\/wordpress-interop<\/a> \u2013 A package based on Doctrine\/DBAL for easier access to the WordPress database from other PHP applications.<\/li>\n<li><a href=\"https:\/\/github.com\/sj-i\/php-profiler\" target=\"_blank\" rel=\"noopener\">sj-i\/php-profiler<\/a> \u2013 A sampling profiler for PHP implemented in pure PHP (FFI). You can generate flame diagrams, run trace output in top-like mode, and more.<\/li>\n<li><a href=\"https:\/\/github.com\/mrsuh\/php-var-sizeof\" target=\"_blank\" rel=\"noopener\">mrsuh\/php-var-sizeof<\/a> \u2013 A function to get the memory size for any variable that promises to be more accurate <a href=\"https:\/\/github.com\/mrsuh\/php-var-sizeof#var_sizeof-vs-memory_get_usage\" target=\"_blank\" rel=\"noopener\">compared to memory_get_usage()<\/a>. Requires PHP 7.4 or higher with FFI.<\/li>\n<li><a href=\"https:\/\/github.com\/davidcole1340\/ext-php-rs\" target=\"_blank\" rel=\"noopener\">davidcole1340\/ext-php-rs<\/a> \u2013 Bindings for the Zend API to build PHP extensions natively in Rust.<\/li>\n<li><a href=\"https:\/\/github.com\/easysoft\/phpmicro\" target=\"_blank\" rel=\"noopener\">easysoft\/phpmicro<\/a> \u2013 A statically compiled micro PHP interpreter that can be bundled with your CLI tools to distribute them as PHP-agnostic binaries. Looking <a href=\"https:\/\/twitter.com\/marcelpociot\/status\/1498244220620099588\" target=\"_blank\" rel=\"noopener\">forward<\/a> to Marcel Pociot automating the process!<\/li>\n<\/ul>\n<h2 id=\"symfony\">Symfony<\/h2>\n<ul>\n<li>See <a href=\"https:\/\/symfony.com\/blog\/category\/living-on-the-edge\/6.1\" target=\"_blank\" rel=\"noopener\">what&#8217;s coming in Symfony 6.1<\/a>.<\/li>\n<li>&#x1f4fa; <a href=\"https:\/\/symfonycasts.com\/screencast\/symfony\" target=\"_blank\" rel=\"noopener\">Harmonious Development with Symfony 6<\/a> \u2013 The 2+ hour tutorial for getting started with Symfony is now fully available for free at SymfonyCasts.<\/li>\n<li><a href=\"https:\/\/jolicode.com\/blog\/using-symfony-form-in-wordpress\" target=\"_blank\" rel=\"noopener\">Using Symfony Form in WordPress<\/a>.<\/li>\n<li><a href=\"https:\/\/symfony.com\/book\" target=\"_blank\" rel=\"noopener\">&#8220;Symfony: The Fast Track&#8221; Symfony<\/a> is now available for Symfony 6.<\/li>\n<li><a href=\"https:\/\/www.symfonystation.com\/Symfony-Station-Communique-29-April-2022\" target=\"_blank\" rel=\"noopener\">Symfony Station Communiqu\u00e9 \u2013 April 29, 2022<\/a>.<\/li>\n<\/ul>\n<h2 id=\"laravel\">Laravel<\/h2>\n<ul>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/watch?v=mH7cgoX3K0g\" target=\"_blank\" rel=\"noopener\">Laravel Origins: The Documentary<\/a> \u2013 This video tells the story of why Laravel came to be, how it&#8217;s grown over the last 10 years, and what the future may hold for Taylor and the wider Laravel community.<\/li>\n<li><a href=\"https:\/\/laravel-idea.com\/blog\/2022\/5-3-release\" target=\"_blank\" rel=\"noopener\">Laravel Idea 5.3<\/a> \u2013 An update to the popular paid PhpStorm plugin comes with the Extract Blade Component refactoring, translation values, and advanced event listeners search.<\/li>\n<li><a href=\"https:\/\/laravelprotips.com\/\" target=\"_blank\" rel=\"noopener\">LaravelProTips.com<\/a> \u2013 A collection of useful articles and tweets.<\/li>\n<li><a href=\"https:\/\/github.com\/alexeymezenin\/laravel-best-practices\" target=\"_blank\" rel=\"noopener\">alexeymezenin\/laravel-best-practices<\/a> \u2013 More Laravel best practices.<\/li>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/watch?v=mmtVkDh9RGw\" target=\"_blank\" rel=\"noopener\">Build a Laravel app and deploy it to production in 5 hours <\/a>\u2013 A speedrun by Brent.<\/li>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/watch?v=Xgn0EtB4chc\" target=\"_blank\" rel=\"noopener\">Xdebug 3: Laravel Sail with PhpStorm<\/a>.<\/li>\n<\/ul>\n<h2 id=\"yii\">Yii<\/h2>\n<ul>\n<li><a href=\"https:\/\/opencollective.com\/yiisoft\/updates\/yii-news-2022-issue-1\" target=\"_blank\" rel=\"noopener\">Yii news 2022, issue 1<\/a>.<\/li>\n<li><a href=\"https:\/\/www.yiiframework.com\/wiki\/2570\/interview-questions-for-yii2\" target=\"_blank\" rel=\"noopener\">Interview Questions For Yii 2<\/a> \u2013 Many of them are about PHP in general and can be useful for all job-seekers.<\/li>\n<\/ul>\n<h2 id=\"misc\">Misc<\/h2>\n<ul>\n<li>Comprehensive posts about <a href=\"https:\/\/www.pascallandau.com\/docker-php-tutorial\/\" target=\"_blank\" rel=\"noopener\">Docker for PHP developers<\/a> by Pascal Landau: <a href=\"https:\/\/www.pascallandau.com\/blog\/docker-from-scratch-for-php-applications-in-2022\/\" target=\"_blank\" rel=\"noopener\">Docker from scratch for PHP 8.1 Applications in 2022<\/a>, <a href=\"https:\/\/www.pascallandau.com\/blog\/phpstorm-docker-xdebug-3-php-8-1-in-2022\/\" target=\"_blank\" rel=\"noopener\">PhpStorm, Docker and Xdebug 3 on PHP 8.1<\/a>, and more on his <a href=\"https:\/\/www.pascallandau.com\/blog\/\" target=\"_blank\" rel=\"noopener\">website<\/a>.<\/li>\n<li>Posts on naming constructors <a href=\"https:\/\/localheinz.com\/blog\/2022\/03\/26\/naming-constructors\/\" target=\"_blank\" rel=\"noopener\">by Andreas M\u00f6ller<\/a> and <a href=\"https:\/\/thephp.cc\/articles\/how-do-you-name-constructors\" target=\"_blank\" rel=\"noopener\">by Stefan Priebsch<\/a>.<\/li>\n<li><a href=\"https:\/\/doeken.org\/blog\/middleware-pattern-in-php\" target=\"_blank\" rel=\"noopener\">How the Middleware Pattern works<\/a> and can easily be applied in PHP.<\/li>\n<li><a href=\"https:\/\/hermanradtke.com\/how-to-mock-functions-that-have-external-http-requests\/\" target=\"_blank\" rel=\"noopener\">How To Mock Functions That Have External HTTP Requests<\/a>.<\/li>\n<li><a href=\"https:\/\/writing-readable-php.com\/\" target=\"_blank\" rel=\"noopener\">Writing Readable PHP<\/a> \u2013 A paid course by Freek Van der Herten and Christoph Rumpel with bite size tips that make your code a joy to read for you, your coworkers, and your future self.<\/li>\n<li><a href=\"https:\/\/peakd.com\/hive-168588\/@crell\/php-tricks-multi-value-match\" target=\"_blank\" rel=\"noopener\">PHP Tricks: Multi-value match()<\/a> \u2014 Did you know you can compare multiple values in a single match expression? Like this:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\" data-enlighter-linenumbers=\"false\" data-enlighter-title=\"\">function mayFriend(User $u1, User $u2, Group $group): FriendPermission\n{\n    return match ([$u1-&gt;inGroup($group), $u2-&gt;inGroup($group)]) {\n        [true, true] =&gt; FriendPermission::Allow,\n        [true, false] =&gt; FriendPermission::WithApproval,\n        [false, true] =&gt; FriendPermission::WithApproval,\n        [false, false] =&gt; FriendPermission::Deny,\n    };\n}\n<\/pre>\n<\/li>\n<li><a href=\"https:\/\/www.exakat.io\/en\/interfaces-are-not-class-templates\/\" target=\"_blank\" rel=\"noopener\">Interfaces are not class templates<\/a>.<\/li>\n<li><a href=\"https:\/\/www.exakat.io\/en\/speeding-up-array_merge\/\" target=\"_blank\" rel=\"noopener\">Speeding up array_merge()<\/a>.<\/li>\n<li><a href=\"https:\/\/www.exakat.io\/en\/all-the-dynamic-syntaxes-in-php\/\" target=\"_blank\" rel=\"noopener\">All the Dynamic Syntaxes in PHP<\/a> \u2013 Good source for interview questions?<\/li>\n<li><a href=\"https:\/\/paragonie.com\/blog\/2022\/01\/solving-open-source-supply-chain-security-for-php-ecosystem\" target=\"_blank\" rel=\"noopener\">Solving Open Source Supply Chain Security for the PHP Ecosystem<\/a> \u2013 An interesting post about the initiatives of the folks at Paragon IE. They are now working on a tool called <a href=\"https:\/\/gossamer.tools\/\" target=\"_blank\" rel=\"noopener\">Gossamer<\/a> to securely update apps and dependencies. Previously, they introduced libsodium to the PHP core, created <a href=\"https:\/\/github.com\/paragonie\/paseto\" target=\"_blank\" rel=\"noopener\">Paseto<\/a>, a safer alternative to JWT, and developed <a href=\"https:\/\/github.com\/paragonie\" target=\"_blank\" rel=\"noopener\">other tools<\/a>.<\/li>\n<li><a href=\"https:\/\/stitcher.io\/blog\/service-locator-anti-pattern\" target=\"_blank\" rel=\"noopener\">Service locator: an anti-pattern<\/a>.<\/li>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/watch?v=WMGYfgzoap0\" target=\"_blank\" rel=\"noopener\">Xdebug 3: Debugging Unit Tests with PhpStorm<\/a>.<\/li>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/playlist?list=PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-\" target=\"_blank\" rel=\"noopener\">Learn PHP The Right Way<\/a> \u2013 Full PHP course in 88 videos for free.<\/li>\n<\/ul>\n<h2 id=\"generics\"><strong>Generics<\/strong><\/h2>\n<p>PHP has seen a lot of generics-related activity lately, so we gave them their own section in this post.<\/p>\n<ul>\n<li>&#x1f4fa; First, check out this series of videos on <a href=\"https:\/\/www.youtube.com\/watch?v=c8hQ1fWU_mQ&amp;list=PL0bgkxUS9EaKyOugEDffRzsvupBE2YEoD\" target=\"_blank\" rel=\"noopener\">Generics in PHP<\/a> from Brent.<\/li>\n<li>If you&#8217;d like to dive deeper, you might be interested in the post about <a href=\"https:\/\/dev.to\/mrsuh\/generics-implementation-approaches-3bf0\" target=\"_blank\" rel=\"noopener\">Generics implementation approaches<\/a>.<\/li>\n<li>Try an interesting project that implements them in PHP: <a href=\"https:\/\/github.com\/mrsuh\/php-generics\" target=\"_blank\" rel=\"noopener\">mrsuh\/php-generics<\/a>. Interestingly, there was a <a href=\"https:\/\/www.reddit.com\/r\/PHP\/comments\/ta5d4u\/php_perfomance_mode_yay_or_nay\/\" target=\"_blank\" rel=\"noopener\">discussion on Reddit<\/a> about dropping the runtime type checks in PHP for performance. The tool above <a href=\"https:\/\/github.com\/mrsuh\/php-generics#type-erasure\" target=\"_blank\" rel=\"noopener\">implements type erasure<\/a>, so it could theoretically be used for such performance use cases: <code>composer dump-generics --type=type-erasure<\/code>.<\/li>\n<li>One of the main applications of generics is collections. Check out <a href=\"https:\/\/dev.to\/mrsuh\/comparing-php-collections-5cca\" target=\"_blank\" rel=\"noopener\">Comparing PHP Collections<\/a>.<\/li>\n<li>And last but not least, fun art by <a href=\"https:\/\/github.com\/SerafimArts\" target=\"_blank\" rel=\"noopener\">@SerafimArts<\/a>: <img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/05\/generics.gif\" alt=\"\"><\/li>\n<\/ul>\n<h2 id=\"community\">Community<\/h2>\n<ul>\n<li>&#x1f4fa; <a href=\"https:\/\/www.youtube.com\/watch?v=PXx9_FFZi8A\" target=\"_blank\" rel=\"noopener\">PHP isn&#8217;t dead, featuring the Laravel Origins cast<\/a>.<\/li>\n<li>\n<blockquote class=\"twitter-tweet\">\n<p dir=\"ltr\" lang=\"en\">PHP is definitely the best array-oriented programming language<\/p>\n<p>\u2014 Jose Diaz (@savant) <a href=\"https:\/\/twitter.com\/savant\/status\/1519785011381161984?ref_src=twsrc%5Etfw\" target=\"_blank\" rel=\"noopener\">April 28, 2022<\/a><\/p><\/blockquote>\n<\/li>\n<li>\n<blockquote class=\"twitter-tweet\">\n<p dir=\"ltr\" lang=\"en\">&#8220;PHP doeSNt sCaLE&#8221;<\/p>\n<p>&#x2601;&#xfe0f; Reached 99.999% (five nines) REAL uptime for ALL my sites on a SINGLE &#x1f916; VPS w\/ 204M reqs\/mo <a href=\"https:\/\/t.co\/s1FQtjucz2\" target=\"_blank\">https:\/\/t.co\/s1FQtjucz2<\/a><\/p>\n<p>&#8220;five nines is high availability of services, when the downtime is less than 5 minutes per year&#8221;<\/p>\n<p>&#x1f973; <a href=\"https:\/\/t.co\/VEM1Kcc5Gw\" target=\"_blank\">pic.twitter.com\/VEM1Kcc5Gw<\/a><\/p>\n<p>\u2014 @levelsio (@levelsio) <a href=\"https:\/\/twitter.com\/levelsio\/status\/1520354529421983745?ref_src=twsrc%5Etfw\" target=\"_blank\" rel=\"noopener\">April 30, 2022<\/a><\/p><\/blockquote>\n<\/li>\n<\/ul>\n<hr>\n<p>That&#8217;s all for today \u2013 thanks for reading!<\/p>\n<p>If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send me a <a href=\"https:\/\/twitter.com\/pronskiy\" target=\"_blank\" rel=\"noopener\">tweet<\/a>.<\/p>\n<p style=\"text-align: left;\" align=\"center\"><a class=\"jb-download-button\" title=\"Complete this form and get PHP Annotated Monthly delivered fresh to your email\" href=\"https:\/\/info.jetbrains.com\/PHP-Annotated-Subscription.html\" target=\"_blank\" rel=\"noopener\">Subscribe to PHP Annotated<\/a><\/p>\n<p><em>Your JetBrains PhpStorm team<\/em><br \/>\n<em>The Drive to Develop<\/em><\/p>\n<p><script async=\"\" src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><br \/>\n<!--<script async src=\"https:\/\/embed.redditmedia.com\/widgets\/platform.js\" charset=\"UTF-8\"><\/script>--><\/p>\n","protected":false},"author":869,"featured_media":21489,"comment_status":"closed","ping_status":"closed","template":"","categories":[],"tags":[2213,190,6433,6755,2323,2648,191,1116,2632],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/phpstorm\/245013"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/phpstorm"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/types\/phpstorm"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/users\/869"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/comments?post=245013"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/phpstorm\/245013\/revisions"}],"predecessor-version":[{"id":245247,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/phpstorm\/245013\/revisions\/245247"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/media\/21489"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/media?parent=245013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/categories?post=245013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/tags?post=245013"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/cross-post-tag?post=245013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}