The PhpStorm Blog : The Lightning-Smart IDE for PHP Programming | The JetBrains Blog https://blog.jetbrains.com Developer Tools for Professionals and Teams Mon, 19 Jun 2023 13:19:29 +0000 en-US hourly 1 https://blog.jetbrains.com/wp-content/uploads/2023/02/cropped-icon-512-32x32.png The PhpStorm Blog : The Lightning-Smart IDE for PHP Programming | The JetBrains Blog https://blog.jetbrains.com 32 32 PhpStorm 2023.2 EAP #4 https://blog.jetbrains.com/phpstorm/2023/06/phpstorm-2023-2-eap-4/ Mon, 19 Jun 2023 13:19:26 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/ps-release-featured_blog_1280x720-2.png https://blog.jetbrains.com/?post_type=phpstorm&p=364712 This build includes a bunch of usability improvements, such as abilities to pin Run configurations and sort files by modification time in the Project view.

The EAP allows you to try new features from the upcoming PhpStorm version, 2023.2. EAP builds are free to use and you can install them side by side with a stable version of PhpStorm. If something doesn’t work correctly, you can quickly switch back to the previous version without interfering with your workflow.

Pin Run configurations

To add a run configuration to the Pinned section, open the kebab menu (three dots) next to its name and select Pin. If you have multiple pinned configurations, you can easily rearrange them with drag and drop.

Sort files by modification time in the Project view 

Starting with PhpStorm 2023.2 EAP #4, it is possible to arrange your files in the Project view based on their modification time. To enable this feature, open the kebab menu (three dots) in the Project view and then select Tree Appearance | Sort by Modification Time.


Please see the release notes for the complete list of changes in the EAP #4 build.

  • Important! PhpStorm EAP builds are not fully tested and may be unstable.
  • You can install an EAP build side by side with a stable PhpStorm version to try out the latest features.
  • EAP builds are free to use and don’t require a license. However, they expire 30 days after the build date and then you’ll have to download a new build.

Please let us know about any problems you find by reporting them to our issue tracker or commenting on this post.

]]>
PHP Annotated – June 2023 https://blog.jetbrains.com/phpstorm/2023/06/php-annotated-june-2023/ Wed, 14 Jun 2023 14:46:44 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/php-annotated-featured_blog_1280x720.png https://blog.jetbrains.com/?post_type=phpstorm&p=363176 PHP Annotated Monthly

Welcome to the June edition of PHP Annotated. We’ll recap the most thrilling developments in the PHP community over the past month, featuring handpicked news, articles, tools, and videos.

Highlights

PHP Core

Most of the Core news is covered in detail in the PHP Core Roundup series from the PHP Foundation, so we’ll only make a few brief mentions:

  • 📣 RFC: Property hooks
    In this RFC, Ilija Tovillo and Larry Garfield propose to declare virtual properties with get/set functions.

    The design and syntax is most similar to Kotlin, although it also draws influence from C# and Swift.

    class User implements Named
    {
        private bool $isModified = false;
     
        public function __construct(private string $first, private string $last) {}
     
        public string $fullName {
            // Override the "read" action with arbitrary logic.
            get => $this->first . " " . $this->last;
     
            // Override the "write" action with arbitrary logic.
            set($value) => [$this->first, $this->last] = explode(' ', $value);
        }
    
  • 📣 RFC: Marking overridden methods (#[\Override])
    Tim Düsterhus suggests introducing a new #[\Override] attribute. This attribute, when applied to a method, would prompt the engine to verify the existence of a method with the same name in a parent class or any implemented interfaces.

    interface I {    public function i(): void;
    }
     
    class P {
        #[\Override]
        public function i(): void {} // Fatal error: P::i() has #[\Override] attribute, but no matching parent method exists
    }
     
    class C extends P implements I {} // All good 👍
    
  • 📣RFC: NameOf
    Robert Landers proposes adding a global nameof() function. This function would enable developers to swiftly and easily retrieve the name of virtually any user-defined variable, property, constant, or member.

    echo nameof($variable); // variable 
    echo nameof($object->property); // property
    echo nameof(Enum::Case); // Case
    echo nameof(Object::Const); // Const
    echo nameof(myFunction(...)); // myFunction
    echo nameof(MY_CONSTANT); // MY_CONSTANT
    

Tools

  • wp-now – A local dev environment from the WordPress engineering team.
    This tool leverages WebAssembly to operate PHP on top of Node.js’ webserver. It’s faster than Docker-based environments and can be used with any PHP apps, although, you’ll have to figure out a way to run your DB.
  • PHP Monitor 6.0 now available – This major update introduces the new PHP Version Manager, a new Standalone Mode that allows the app to work without having Valet installed, and more.
  • pmjones/AutoShel – Automatically maps CLI command names to PHP command classes in a specified namespace, reflecting on a specified main method within that class to determine the argument and option values. The method parameters may be scalar values(int, float, string, bool) or arrays.
  • jolicode/castor – A task runner and command launcher designed with a focus on developer experience, built using PHP.
  • ProjektGopher/whisky – Simple and framework-agnostic CLI tool for managing and enforcing a PHP project’s git hooks across a team.
  • schranz-search/schranz-search – Search abstraction over different search engines written in PHP. The currently implemented engines include Elasticsearch, Opensearch, Algolia, Meilisearch, RediSearch, Solr, and Typesense.
  • TestGenAI – A tool by Tomas Votruba, the author of Rector, to generate unit tests for PHP code.
  • librarianphp/librarian – A static site generator and markdown indexer inspired by Hugo and DEV, written in PHP. Read the story behind this creation.

Symfony

Laravel

Other frameworks

Misc

Conferences

In-person events are in full swing. Check out these upcoming PHP gigs worth visiting and applying to present at:

  • Laracon US – Nashville, TN, USA, July 19–20, 2023.
  • CakeFest – Los Angeles, CA, USA, Sep 28–Oct 3, 2023.
  • Longhorn PHP – Austin, TX, USA, November 2-4, 2023.
  • SymfonyCon – Brussels, Belgium, December 7–8, 2023.

If you’re wondering when the next PHP meetup is happening, Tomas Votruba has got you covered with his lovely friendsofphp.org meetup aggregator. There is also a calendar on php.net – Events: June 2023.


If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send us a tweet.

Subscribe to PHP Annotated

Roman Pronskiy

Product marketing manager for @PhpStorm, had a hand in the creation of @The PHP Foundation.

Twitter | GitHub

]]>
PhpStorm 2023.2 EAP #3 https://blog.jetbrains.com/phpstorm/2023/06/phpstorm-2023-2-eap-3/ Wed, 14 Jun 2023 12:41:25 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/ps-release-featured_blog_1280x720-1.png https://blog.jetbrains.com/?post_type=phpstorm&p=362985 The third build of our Early Access Program for PhpStorm 2023.2 is now available!

This blog post will cover support for object shape annotations that improve code completion for dynamic objects.

The Toolbox App is the easiest way to get the EAP builds and keep your stable and EAP versions up to date. You can also manually download the EAP builds from our website.

Object shapes support

In this release, we are adding the ability to define the structure of generic objects via shape annotation, similar to how it is done for array shapes

While you would normally define objects via declared properties, you may also need proper code completion for dynamic properties with classes like stdClass or functions like __get()/__set() or json_decode().

Now you can define the structure of an arbitrary object in a PHPDoc comment, and PhpStorm will parse the object shape and display a code completion tooltip during assignment of object properties. The syntax is supported for nested objects as well.

The other way around, you can use a PhpStorm quick-fix Alt+Enter to generate object shapes in a PHPDoc comment or an #[ObjectShape] attribute for the objects that already have properties assigned to them.


Please see the release notes for the complete list of changes in the EAP #2 build.

  • Important! PhpStorm EAP builds are not fully tested and may be unstable.
  • You can install an EAP build side by side with a stable PhpStorm version to try out the latest features.
  • EAP builds are free to use and don’t require a license. However, they expire 30 days after the build date and then you’ll have to download a new build.

Please let us know about any problems you find by reporting them to our issue tracker or commenting on this post.

]]>
PhpStorm 2023.2 EAP #2 https://blog.jetbrains.com/phpstorm/2023/06/phpstorm-2023-2-eap-2/ Mon, 05 Jun 2023 14:08:12 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/ps-release-featured_blog_1280x720.png https://blog.jetbrains.com/?post_type=phpstorm&p=360318 In this build, you’ll find support for GitLab Merge Requests.

The EAP allows you to try new features from the upcoming PhpStorm version, 2023.2. EAP builds are free to use and you can install them side by side with a stable version of PhpStorm. If something doesn’t work correctly, you can quickly switch back to the previous version without interfering with your workflow.

GitLab Merge Requests support

PhpStorm 2023.2 EAP 2 introduces initial integration with GitLab, allowing you to work with Merge Requests right from the IDE.


Please see the release notes for the complete list of changes in the EAP #2 build.

  • Important! PhpStorm EAP builds are not fully tested and may be unstable.
  • You can install an EAP build side by side with a stable PhpStorm version to try out the latest features.
  • EAP builds are free to use and don’t require a license. However, they expire 30 days after the build date and then you’ll have to download a new build.

Please let us know about any problems you find by reporting them to our issue tracker or commenting on this post.

]]>
The PhpStorm 2023.2 Early Access Program Is Open https://blog.jetbrains.com/phpstorm/2023/05/the-phpstorm-2023-2-early-access-program-is-open/ Fri, 19 May 2023 15:09:30 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/Blog_Featured_image_1280x600_PhpStorm-2x.png https://blog.jetbrains.com/?post_type=phpstorm&p=357067 The Early Access Program (EAP) for the next major PhpStorm release starts today!

In this first EAP build, you’ll get improvements for generics in PHP and a bunch of other user experience enhancements.

If you’re unfamiliar with how our EAP works, here’s a quick recap:

  • We publish new EAP builds every week and showcase upcoming features.
  • EAP builds are free to use and don’t require a license.
  • You can install the EAP version alongside your stable version of PhpStorm, so there is no need to uninstall it.
  • The easiest way to get EAP builds and keep both your stable and EAP versions up to date is with the Toolbox App.
  • Download builds from the EAP page or receive them automatically in the IDE by selecting Check IDE Updates for the Early Access Program under Settings/Preferences | Appearance & Behavior | System Settings | Updates.

Let’s look at what’s new in the first EAP build of PhpStorm 2023.2.


Generics in PHP

New Rename generic refactoring

Press Shift+F6 to invoke renaming of a generic type. PhpStorm will automatically update the name throughout the whole codebase.

Alternatively, you can press Ctrl+T and choose the Rename menu option.

Support for the `static` type in generics

One of the things that was missing and was highly anticipated was support for static references in generic templates. 

It has finally been fixed in this release, and we’re working to make PHP’s generics support the best possible.

Xdebug: download and install extension on Windows

Configuring Xdebug can be hard, so we’ve tried to improve it with every release.

When starting the debugger for the first time, if PhpStorm cannot connect to Xdebug, then the IDE will offer downloading the extension and installing it locally by updating `php.in`.

So far, this works only for Windows. If you are on macOS, then use Homebrew, and for Linux, use your packet manager of choice. 

User experience

Reworked hamburger menu in the main toolbar on Windows and Linux

We’ve refined the behavior of the hamburger menu in the new UI, located in the main toolbar for Windows and Linux. Once you click on the menu icon, the elements now appear horizontally over the toolbar.

Also, there’s now an option to turn this menu into a separate toolbar. To do so, go to View | Appearance | Main menu as a Separate Toolbar.


That’s all for the first build! We’ll keep you informed about any upcoming changes in the weekly EAP blog posts.

The complete list of updates in this build is available in the release notes.

Please report any problems you find to our issue tracker, or leave a comment below.

]]>
PhpStorm 2023.1.2 is released https://blog.jetbrains.com/phpstorm/2023/05/phpstorm-2023-1-2-is-released/ Wed, 17 May 2023 14:22:32 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/ps-release-blog-featured-image-1280x600-1-1.png https://blog.jetbrains.com/?post_type=phpstorm&p=355964 A new bug-fix update for PhpStorm 2023.1 is now available.

You can update to it using the Toolbox App or right from inside the IDE. You can also download PhpStorm 2023.1.2 from the website.

Notable changes in this update:

  • Fix: Editor tabs scroll very slowly [IDEA-318576]
  • Fix: Project on an NFS mounted drive is considered read-only [IDEA-315865]
  • Fix: Crazy long ‘Type annotation’ inlay hints in JavaScript [WEB-59322]
  • Fix: Angular: Incorrect type evaluation for pipes with transform property with indirect function instead of method [WEB-50918]
  • Fix: Improve documentation for Angular related symbols [WEB-33153]
  • Fix: CSS Custom Properties: Whitespace is marked as incorrect value [WEB-20700]
  • Fix: Stop Debug button is missing from the main toolbar during web debugging since 2023.1.1 [WI-72524]
  • Fix: IDE ignores indentation settings that are specified for general SQL dialect [DBE-17878]
  • Fix: EXPLAIN ANALYSE disappears from context menu for MySQL after first run [DBE-17813]
  • Fix: PHPUnit 10: –whitelist option for coverage is no longer supported [WI-71423]

The full list of changes is available in the release notes.
And as always, please feel free to report any issues you encounter to our tracker or here in the comments.

]]>
PhpStorm 2023.1.1 is released https://blog.jetbrains.com/phpstorm/2023/05/phpstorm-2023-1-1-is-released/ Tue, 02 May 2023 08:57:52 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/ps-release-blog-featured-image-1280x600-1.png https://blog.jetbrains.com/?post_type=phpstorm&p=347176 The first bug-fix update for PhpStorm 2023.1 is now available.

You can update to it using the Toolbox App or right from inside the IDE. You can also download PhpStorm 2023.1.1 from the website.

Notable changes in this update:

  • Fix: [macOS Ventura] Screen flickering after OS update when IDE is full screen [JBR-4959]
  • Fix: IDE flicker with two monitors [JBR-5417]
  • Fix: VCS widget: branch name truncated too much [IDEA-294594]
  • Fix: Docker desktop for linux create docker.sock in other folder instead of /var/run/docker.sock [IDEA-294871]
  • Fix: Vue Lifecycle Events are marked as unused [WEB-38671]
  • Fix: New UI: window header is hard to resize on the top edge, top/right corner [JBR-5384]
  • Fix: “Commit checks” settings are not saved [IDEA-315281]
  • Fix: Wrong large IDE scaling on 4k Screen [JBR-5316]
  • New: Support import() of typedef’s in JSDoc from other modules/packages [WEB-52385]
  • New: Generics: Infer the “@template T of Type” in the generic class itself [WI-65460]
  • New: Generics: Support wrapping T into T[] [WI-62769]
  • Fix: Generic autocomplete does not work with class properties. [WI-63845]

The full list of changes is available in the release notes.
And as always, please feel free to report any issues you encounter to our tracker or here in the comments.

]]>
PHP Annotated – April 2023 https://blog.jetbrains.com/phpstorm/2023/04/php-annotated-april-2023/ Fri, 21 Apr 2023 16:07:13 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/04/php-annotated-blog-featured-image-1280x600-1.png https://blog.jetbrains.com/?post_type=phpstorm&p=344666 PHP Annotated Monthly

Greetings everyone!

Welcome to the April installment of PHP Annotated, where we’ll catch up on the most exciting things that have happened in the PHP world over the last month, including curated news, articles, tools, and videos.

News

PHP Core

Most of the Core news is covered in detail in the PHP Core Roundup series from the PHP Foundation, so we’ll only list a few highlights:

  • RFC: Arbitrary static variable initializers
    PHP allows declaring static variables inside any functions. Their values outlive the function call and are shared across future execution of the function.

    In PHP 8.3, you can assign them any expression, e.g. the result of another function.

    function bar() {    
        echo "bar() called\n";
        return 1;
    }
     
    function foo() {
        static $i = bar();  // This currently produces a fatal error, but will work in PHP 8.3
        echo $i++, "\n";
    }
     
    foo();
    // bar() called
    // 1
    foo();
    // 2
    foo();
    // 3
    

    As a side effect, in PHP 8.3 redeclaring static variables will be forbidden. This will fix some PHP quirks that you have hopefully never seen in real code:

    <?php
    function f()
    {
      static $x = 1;
    
      return $x;
    
      static $x = 2;
    }
    echo f();
    

    If you expected the second static declaration to be unreachable, you’d unfortunately be mistaken: https://3v4l.org/HhpYj

  • 📣 RFC: Clone with
    Máté Kocsis proposed to add support for a new language construct called “clone with” by extending the clone operator, making it possible to write “wither” methods for any kind of instance properties (declared/dynamic, typed/untyped, readonly/non-readonly) with less code.

    Example
    class Response implements ResponseInterface {    public readonly int $statusCode;
        public readonly string $reasonPhrase;
        // ...
        public function withStatus($code, $reasonPhrase = ''): Response
        {
            return clone $this with {
                statusCode: $code,
                reasonPhrase: $reasonPhrase
            };
        }
        // ...
    }
    
    $response = new Response(200);
    $response->withStatus(201)->withStatus(202);
    
  • 📣 RFC: New core autoloading mechanism with support for function autoloading
    George Peter Banyard and Dan Ackroyd propose a better-designed class-autoloading mechanism, and add a new function-autoloading mechanism.
  • 📣 Jakub Zelenka proposes to form PHP Technical Committee
    PHP uses RFC voting to decide on user-visible language changes, which works well despite some known issues. However, it’s not as effective for technical changes that impact PHP internals and extension APIs, and conflicts between contributors on technical bases are not easily resolved.

    The proposed committee would consist of 5 elected members and, should a dispute or question about a change arise, the committee may be called on to resolve it.

Tools

  • crazywhalecc/static-php-cli – The tool for building PHP apps into a single binary file with no extra dependencies.
  • aschmelyun/subvert – Generate subtitles, summaries, and chapters from videos in seconds.
  • yiisoft/db – Framework-agnostic query builder for different types of databases (MariaDB, MSSQL, MySQL, Oracle, PostgreSQL, and SQLite).
  • Crell/EnvMapper – Easily map environment variables into defined classed objects, ready for dependency injection.
  • PHP Skeleton for Bison by Anton Sukhachev.
    The syntax of PHP and many other languages is described by grammar in Bison format. mrsuh/php-bison-skeleton makes it possible to generate a Bison parser in PHP without third-party dependencies.
  • 🚧 NativePHP
    Marcel Pociot is building a tool to run Laravel/PHP apps on desktop on top of Electron or Tauri.

Symfony

Laravel

  • Laravel Valet 4.0 released
    Despite the name, Laravel Valet is a minimalistic development environment for macOS that can be used for any PHP project.

    This release is mostly about rewriting the internals, so they’re easier to debug, fix, and modify. It also brings a new valet status command and supports Expose as a sharing option.

  • Laravel IDEA 7.0
    The popular plugin for PhpStorm has received a major update. It includes the “New Eloquent Model” UI and Twig templates support.

    Check out this video demo on Laravel Daily.

  • Build a ChatGPT clone using the new OpenAI Chat API by Marcel Pociot.
  • Everything You Can Test In Your Laravel Application by Christoph Rumpel – Excellent guide with examples of scenarios you’ll likely need to test on real applications.
  • TomasVotruba/bladestan – PHPStan analysis for Blade templates.
  • lunarphp/lunar – An open-source headless e-commerce package for Laravel. You have complete freedom to create your own storefront, but the backend work is already done for you.
  • area17/twill – A CMS toolkit for Laravel that helps rapidly create a custom admin console that is intuitive, powerful, and flexible.
  • 📺 Laravel Weekly Update #6 – The team now provides a weekly roundup of Laravel news and updates in short videos.

Misc

Community

  • In case you missed it, Brent and Roman are now doing a video version of PHP Annotated. Check out the latest installment and be sure to subscribe to the PHP Annotated YouTube channel.
  • PoPHPularity: Is it decreasing and what to do about it? by Christian Olear.
  • Modern PHP by Dimitrios Lytras – “While I wasn’t paying attention, PHP got quite good.”

Conferences

Check out these upcoming PHP gatherings worth visiting and applying to present at:


If you have any interesting or useful links to share via PHP Annotated, please leave a comment on this post or send us a tweet.

Subscribe
to PHP Annotated

Roman Pronskiy

Product marketing manager for @PhpStorm, had a hand in creation of @The PHP Foundation.

Twitter | GitHub

]]>
What’s New In PhpStorm 2023.1: New UI Features, Better Performance, 3v4l Support, and More https://blog.jetbrains.com/phpstorm/2023/04/phpstorm-2023-1/ Tue, 04 Apr 2023 10:02:43 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/04/Release_Preview_image_1280x600_PhpStorm-2x.png https://blog.jetbrains.com/?post_type=phpstorm&p=339586 PhpStorm 2023.1 is now available!

This release is a major update that includes integration with 3v4l.org, improved performance, enhancements to the new UI, a DFA debugger for PHP, and much more.

Download PhpStorm 2023.1

For a quick video overview, check out this roundup of the key changes from our Developer Advocate, Brent.

New UI Beta

This release of PhpStorm includes a polished version of the new UI, which has been improved based on feedback and research. 

Enable the new UI in Preferences / Settings | Appearance & Behavior | New UI.

Compact Mode

PhpStorm now has Compact Mode, which reduces the size of toolbars, tool window headers, and buttons to help you focus on your code.

To turn it on, go to View | Appearance | Compact Mode.

Visible file name pane when tabs are hidden in the new UI

The name of the file that is currently open is now displayed in a pane when editor tabs are hidden. 

Vertical split for tool windows

We’ve added a setting in the new UI that allows you to divide the tool window’s area into 2 windows and arrange them so that you can see both at the same time. This is something you could do in the old UI, but it was missing in the new version.

To add a tool window to this area and place it in the lower part, drag its icon along the sidebar and drop it under the separator. Alternatively, you can right-click on the icon and assign the new placement for the tool window using the Move to action.

Project tabs in the new UI on macOS

When working with several projects in the same window, macOS users can now easily switch between them using project tabs displayed under the main toolbar.

By default in macOS, window tabs are enabled only in full-screen mode. If you want them permanently enabled, adjust the system preferences like this:

Redesigned Run widget for the new UI

In response to the feedback we’ve received about the IDE’s new UI, we’ve redesigned the Run widget in the main window header so that its appearance is unobtrusive and easier on the eyes. 

Run PHP Scratch Files on 3v4l.org


3v4l.org is a popular service that lets you test PHP code on all versions of PHP, even those that have not yet been released.

PhpStorm 2023.1 now integrates with 3v4l.org, enabling you to run PHP scratch files on a desired PHP version without any additional installations.

Create a new PHP scratch file by pressing Cmd+Shift+N

Choose your desired PHP version from the drop-down and press the Run button. You’ll see the output of the script next to the editor.

You can also run arbitrary code from your project. To do this, select a piece of code, press Alt+Enter, and then choose Create new scratch file from selection

If you find the 3v4l.org service useful, consider supporting its author with a donation here: https://3v4l.org/sponsor.

Performance Improvements

Shared indexes for popular PHP packages

As part of our work to improve performance, we have added downloadable shared indexes for PHP dependencies.

Unlike regular indexes, which are built locally in your PhpStorm, shared indexes are generated once and later reused on another computer whenever they are needed. 

For example, symfony/console is one of the most used PHP packages in the world. Why should everyone need to compute its index over and over again if we can just index it once and share it? This is what shared indexes are about.

When you open a PHP project in v2023.1, PhpStorm checks composer.json to see which of the dependencies specified have a prebuilt shared index. For example, popular versions of packages like PHPUnit, aws/aws-sdk-php, doctrine/orm, laravel/framework, symfony/*, and many others have downloadable indexes.

PhpStorm may download the index or rebuild it locally, depending on whether your CPU and RAM are faster than your internet connection.

You can also generate your own shared indexes for your private projects. Here is, for example, a prebuilt shared index for Shopware by Shyim: https://github.com/shopwareLabs/shopware-shared-project-cache-generator.

Learn more about how to do so in the docs.

Highlighting during indexing

Annotating the code is now possible even when indexing is still in progress. This allows PhpStorm to highlight many errors and soft keywords in advance, making your workflow smoother and more efficient.

Faster inspections

We’ve enhanced the performance of all inspections, particularly the most resource-intensive ones, resulting in a 30–40% improvement in some cases. Although the boosted performance may not be as significant for other inspections, the combined effect is noticeable, especially for larger files.

Blade templates

We have significantly improved the performance of highlighting inside @php…@endphp tags. All keywords and constructs are now highlighted much faster, regardless of the complexity of the code.

Go to Class action available during indexing

We are striving to make as many actions as possible available during indexing. One of the most popular actions for navigating through code is Go to Class (Cmd+O or Navigate | Class…).
In v2023.1, this action is available at any time, even while your index is being rebuilt. Previously, it would display an empty list until indexing was finished.

Before:

After:

Earlier availability of IDE features on project opening

We’ve enhanced the IDE startup experience so it now performs Scanning files to index… in smart mode. As a result, the IDE’s full functionality is available much earlier in the startup process. 

When you open a project in PhpStorm 2023.1, the IDE uses caches from your previous session and scans for files to index at the same time. If no changes are detected during the scan, the IDE will be ready, eliminating the delays caused by indexing during startup in previous versions.

A new IDE suggestion to reconfigure Microsoft Defender settings for better performance

Microsoft Defender’s Real-Time Protection checks can significantly decrease the speed of the IDE. To avoid this, PhpStorm will suggest adding certain folders to Defender’s list of exclusions.

The notification provides the option to either reconfigure these settings automatically or first check the Defender configuration instructions and do it manually.

Support for multi-composer and multi-vendor projects

In previous versions of PhpStorm, all open projects were treated as a single space. However, we have noticed an increase in the number of cases where a project contains multiple applications, each with its own composer.json dependencies.

To support such projects, we have implemented a foundation that allows for multiple composer.json files and vendor directories. This enhancement brings several benefits:

  • Excluded directories are correctly set, resulting in improved overall performance from running fewer analyses and inspections. It also makes multi-resolve more stable.
  • PSR roots are accurately detected, allowing refactorings like Move Class to work correctly when dragging and dropping classes between applications in the project.
  • Missing extensions in composer.json are reported accurately per application.
  • Test framework roots are detected correctly for each composer.json instance. This helps ensure tests are created in the correct paths.

We’d like to continue improving the support for multi-application projects. If you work extensively with such projects, let us know what you are missing.

Debugger With Data Flow Analysis

If you use Xdebug to debug PHP applications with PhpStorm, you’ll notice that the IDE now allows you to see conditional values ahead of time and dims out runtime-unreachable code.

You’ll also see that PhpStorm shows the precomputed results of conditions in the inlay to the right before the code is executed. This allows you to get a sense of the situation in your code without digging deeper.

These features are provided by the new Data Flow Analysis (DFA). Let’s see it in action:

Branches that will not be executed will be grayed out during the debugging session.

Turn off DFA during debugging

To disable DFA during debugging, right-click on any precomputed value inlay and turn off the feature for the current session.

If you’d like to turn off the feature permanently, you can do so under Preferences/Settings | PHP | Debug | Xdebug.

Limitations

Currently, PhpStorm does not precompute property values due to technical limitations. This is an area for future development.

Custom Regexp-based search and replace inspections

You can now use regular expressions to create your own search and replace inspections. These inspections can be especially useful for highlighting style and formatting problems or simple code-related issues.


Go to Settings/Preferences | Editor | Inspections and press the + icon. Select Add RegExp Search Inspection (or Replace) from the list, and you’ll be directed to a dialog where you can set up your new inspection. 

Select the language, use the hints on the left to build a regexp, and designate the required replacement for the selected pieces of code. You can also specify how you want the IDE to highlight them in the project.

For more advanced inspections that may involve type hierarchy checks, you can use Structural Search and Replace (SSR) inspections. Learn more about them in the docs, or check out the example in the video.

Quality-of-Life Improvements for PHP

Clickable paths and class references for var_dump() / dd() output in the terminal

We want to improve the debugging experience for users who prefer the “dump and die” approach. As a first step, we’ve already made file paths and class references active. Clicking on them opens the corresponding file in the editor.

Descriptions for file open modes in the completion popup

In the previous PhpStorm release, we added descriptions for different formats in date-time functions.

In PhpStorm 2023.1, the date-time format is now shown in Carbon functions where applicable, as well as in WordPress’ date-time functions. For instance, in `wp_date()`:

This release also offers descriptions of file open modes so you don’t have to remember what `r+`, `a`, `w`, etc. all mean!

More live templates

We’ve introduced more live templates, including fun for the function template:

… and fori for indexed `for` loops:

Learn more about how to use live templates from Christoph Rumpel’s video tutorial.

Support for all PHPStan and Psalm tags

All existing PHPStan and Psalm tags are now parsed correctly in PhpStorm. This makes heavily annotated code more readable.

Generics support improvements

Support for generics is traditionally one of the most desirable features in PHP. Regardless of whether this feature is implemented natively in PHP or not, we want users to be able to fully benefit from generics in PhpStorm. 

In this release, we have improved inspections for generics and covered the remaining edge cases. Here are some of the top-voted issues that we plan to address:

  • WI-65460 Infer the “@template T of Type” in the generic class itself.
  • WI-62769 Generics: Support wrapping T into T[].

User Experience

Full IDE zoom

It is now possible to zoom in and out of PhpStorm as a whole, changing the size of all UI elements simultaneously. From the main menu, select View | Appearance and adjust the IDE’s scaling.

This could be particularly helpful for livestreams, online meetings, or presentations.

Giving these actions unique shortcuts in Settings/Preferences | Keymap | Main Menu | View | Appearance also makes it simpler for you to invoke them. 

Another way to assign shortcuts is by going to the Search Actions window (Cmd+Shift+A) and pressing Alt+Enter

Option to save multiple tool window layouts 

You can now save and manage several tool window layouts and switch between them when needed. Check out the new actions under Window | Layouts to save, update, and activate the layouts.

Setting to configure Actions on Save for new projects

PhpStorm 2023.1 now offers the ability to predefine the Actions on Save behavior for new projects. Simply go to File | New Projects Setup | Preferences For New Projects | Tools | Actions on Save and select the actions you wish to trigger when saving changes in future projects.

Setting to configure Actions on Save for new projects

Editor

Fill Paragraph for Markdown files

The new Fill Paragraph feature lets you break up long pieces of text into lines of equal length. To do this, put the caret inside the paragraph you want to change and choose the action from the Edit menu. You can also use Find Action (Cmd+Shift+A) to look for the Fill Paragraph command and run it. 

New Smart Keys settings page for Markdown

We’ve added a page to Settings/Preferences | Editor | General | Smart Keys where you can set up and change your Markdown preferences.

This page should make it easier for you to manage your preferences because it has separate checkboxes for different editor features. Previously, there was only one checkbox in Settings/Preferences | Languages & Frameworks. 

Option to show whitespaces only in selected code

There’s a new Selection checkbox in Settings/Preferences | Editor | General | Appearance | Show Whitespaces that allows you to configure this setting so that the IDE shows whitespaces as small dots only when you select code. 

VCS / Git / GitHub

VCS status color hints in the Structure tool window

In the Structure tool window, we’ve added color hints for changes.

This means you can now see which properties, methods, functions, and so on have been changed or added.

Improved Branches popup

It is now easier to move between branches because they are stored in lists that can be expanded. 

Autocompletion in the Create New Branch popup

With PhpStorm 2023.1, we’ve implemented autocompletion in the Create New Branch popup. Once you start typing a name for your new branch, the IDE will suggest relevant prefixes based on the names of existing local branches.

Background pre-commit checks

Pre-commit checks for Git and Mercurial are now performed in the background after you commit but before you push. This should speed up the overall commit process.

Improved code review workflow for GitHub

Our research shows that pull requests are often initiated on GitHub and then sent to the IDE for comprehensive code browsing. To streamline this workflow, we’ve redesigned the Pull Request tool window, which now includes a dedicated tab for each pull request that you open. This tab shows a clear list of modified files and minimizes distractions, allowing you to focus better on the task at hand. 

Additionally, there is a dedicated button to perform the most relevant action based on the current state of the pull request.

Docker Improvements

Merged log from all Docker-compose containers

The Dashboard tab of the Docker Compose node now pulls together logs from all Docker Compose containers and displays them all in one place. They are also updated in real time.

Showing the services tool window's new dashboard

Support for Azure Container Registry

You can now easily connect to the Azure Container Registry. 

Go to Preferences / Settings | Build, Execution, Deployment | Docker | Docker Registry and set it up by selecting the Docker V2 option in the Registry input field.

Showing the Docker V2 option available in the Registry input field

New setting to apply the :z mount option to bind volumes on SELinux

We’ve added the ability to add the :z configuration flag to Docker bind mounts, which allows you to connect volumes to Docker containers on SELinux workstations. 

To enable this function, go to Preferences / Settings | Advanced Settings | Docker.

Showing the settings with the apply mount option selected

Web

Astro support

Long-awaited Astro support has landed in PhpStorm! You can get it through our new Astro plugin, which can be installed from Preferences / Settings | Plugins. The plugin provides basic functionality, including syntax highlighting, code completion with automatic imports, refactorings, navigation, correct formatting, and more.

Support for TypeScript in Vue templates

We’ve added TypeScript support in Vue templates. It’s enabled when you set the lang attribute in a script tag to ts. Previously, JavaScript was used regardless of the lang attribute in the script tag. PhpStorm will now provide support for inline casting, improved type narrowing, and correct information about inferred types in quick documentation in templates of Vue Single-File Components.

Tailwind CSS configuration

In this release, we’ve added support for configuration options, such as custom class name completion under the classAttributes option, or experimental ones like tailwindCSS.experimental.configFile.

You can set up these configuration options under Preferences / Settings | Languages & Frameworks | Style Sheets | Tailwind CSS.


The full list of changes in PhpStorm 2023.1 is available on the release notes page.

That’s all for today. Thanks for keeping up with the changes!
We hope they improve your PhpStorm experience.

]]>
PhpStorm 2023.1 RC2 https://blog.jetbrains.com/phpstorm/2023/03/phpstorm-2023-1-rc2/ Tue, 28 Mar 2023 14:45:52 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/03/ps-news-text-blog-featured-image-1280x600-1-2.png https://blog.jetbrains.com/?post_type=phpstorm&p=337285 The second release candidate for PhpStorm 2023.1 is now available. It’s the final build before the stable release.

Unlike EAP builds, this RC requires you to have a valid PhpStorm license.

Let’s take a brief look at some of the most interesting improvements coming in v2023.1:

The full list of changes that have been introduced since the last build is available in the release notes.

Thank you for using PhpStorm, and stay tuned for the 2023.1 release next week!

Download PhpStorm 2023.1 RC

]]>
PhpStorm 2023.1 RC https://blog.jetbrains.com/phpstorm/2023/03/phpstorm-2023-1-rc/ Mon, 20 Mar 2023 17:08:03 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/03/ps-bug-fix-blog-featured-image-1280x600-1.png https://blog.jetbrains.com/?post_type=phpstorm&p=334154 PhpStorm 2023.1 Release Candidate is now available!

Unlike previous EAP builds, this RC requires you to have a valid PhpStorm license.

Let’s take a brief look at some of the most interesting improvements coming in v2023.1:

The full list of changes that have been introduced since the last build is available in the release notes.

Thank you for using PhpStorm, and stay tuned for the 2023.1 release next week!

Download PhpStorm 2023.1 RC

]]>
PhpStorm 2022.2.5 is now available https://blog.jetbrains.com/phpstorm/2023/03/phpstorm-2022-2-5-is-now-available/ Mon, 20 Mar 2023 13:40:21 +0000 https://blog.jetbrains.com/?post_type=phpstorm&p=333562 PhpStorm 2022.2.5 is a bug-fix update.

Here are the most notable bug fixes in this build:

  • Fixed: Debug not working because max websocket buffer size limit is exceeded [WEB-59866]
  • Fixed: QUALIFY is not inserted on new line as HAVING [DBE-15604]
  • Fixed: Can’t rename postgres DB [DBE-12680]

The full list of changes in PhpStorm 2022.2.5 is available in the release notes.


]]>