May 2025 – Version 1.85

We’re excited to announce version 1.85 of PHP Tools, bringing a series of performance improvements, smarter type inference, enhanced Laravel support, and important bug fixes. This update continues our mission to provide accurate, efficient, and developer-friendly PHP tooling.


🔧 Improvements

Smarter Type Handling and Inference

  • First-Class Callable Syntax: Added proper type handling for the new first-class callable syntax introduced in PHP 8.1. This resolves type inference issues with callable references (#2239).
  • Instanceof Inference: Improved type inference when using the instanceof operator, making conditions and smart casts more reliable.
  • Dynamic Properties: Enhanced support for type inferring dynamic fields when the __get() magic method is defined.
  • Control Flow Analysis: Several updates were made to improve the accuracy of control flow analysis, leading to better detection of unreachable code, type narrowing, and possible errors.
  • explode() Return Type: Corrected type inference for the explode() function to avoid incorrectly including bool as a possible return type in PHP 8 and later.

Enhanced Code Actions

  • Convert to Arrow Function: Introduced a new code action that lets you quickly convert closures to arrow functions (fn) when applicable.
  • Improved is_null() Refactoring: Refined the code action that replaces is_null() with strict comparison, especially in cases involving negation or complex expressions.

Documentation and Annotation Support

  • PHPDoc Enhancements:

    • Added support for the @param-closure-this tag, improving context awareness for closures.
    • Added validation and support for the @require-implements and @require-extends tags, ensuring annotated constraints are respected in inheritance.
  • Integrated Stubs Update: Updated bundled PHP stubs to improve IntelliSense and type resolution for core functions and classes.

  • Lambda Scope Handling: Adjusted handling of the newScope context in lambda functions, improving member visibility checks and code completion in closures and anonymous functions.

Performance

  • General performance improvements were implemented, resulting in a smoother development experience, especially in large codebases.

⚙️ Laravel-Specific Enhancements

We continue to deepen Laravel support to make development with the framework even more seamless:

  • Improved Type Inference: Enhanced understanding of Laravel-specific helper functions and dynamic return types.
  • IDE Helper Compatibility: Better compatibility with the _ide_helper.php file, including workarounds for improperly generated Eloquent classes.
  • Eloquent Integration: Smarter autocompletion and type inference when using Eloquent models, especially when working with Auth::user() and Request::user.
  • IDE-Helper Hack Support: Ensures Laravel code completion remains functional even when relying on the common IDE-helper hack.

🐞 Fixes

  • Stability Improvements: Various under-the-hood fixes to enhance overall editor and language server stability.
  • Code Formatter Fixes: Resolved several formatting inconsistencies for a cleaner and more predictable code style.
  • Closure Return Reference Fix: Fixed an issue where returning a reference from a closure could lead to false-positive warnings (#831).

This release includes dozens of refinements aimed at making your PHP development faster, more accurate, and better integrated with the tools and frameworks you rely on. As always, thank you for your feedback and support!