PHP Tools for Visual Studio v1.74.18199

Released: Jul 7, 2023

Updates in v1.74.18199

Features

  • IntelliPHP
    • Introducing AI-powered inline code predictions to enhance productivity for PHP. IntelliPHP leverages machine learning to provide intelligent code predictions. As you type, the extension suggests relevant code completions and shows them as gray text in your editor. This feature helps you write code faster and reduces the time spent on manual typing.
      • The code predictions work completely offline, and do not send or receive any data to Internet.
      • The feature is only available to Microsoft Visual Studio 2022 (and future versions).
  • New IntelliSense Features
    • IntelliSense and IteratorIterator - IteratorIterator and RecursiveIteratorIterator have been extended with generic type argument TInner, @mixin TInner, and their __construct() infers this TInner. Therefore, IntelliSense knows the inner iterator type and so it can provide inner iterator's members.
    • IntelliSense and @phpstan-type, @psalm-type, @phpstan-import-type - Added basic support for local type aliasing.
    • IntelliSense and Traits with Generics - Trait use can now be annotated with @use doc comment to specify the trait's generic arguments.
    • IntelliSense and static Type - Re-implemented the internals and improved type analysis for various cases involving use of static and $this within traits, protected properties, and class inheritance in general. Moreover generic arguments and trait members are now resolved better with more inherited type information.
    • Other IntelliSense Features:
      • @phpstan-type and @phpstan-import-type are now supported.
      • phpstan.neon (and .dist alternatives) in containing directories are now processed, supporting their global type aliases (phpstan.neon file's "typeAliases" setting).
      • Improved Laravel IntelliSense.
      • Added new quick refactorings through code actions.
      • Updated integrated PHP manual and localizations.
      • Added support for PHP 8.2 standalone true, false, and null type names.
  • Formatting
    • Re-implemented the underlying mechanisms responsible for formatting contained languages. This enhancement brings significant improvements to the formatting of code when PHP is combined with HTML, CSS, or JS. By revamping the formatting process, the resulting code is well-formatted.

Fixes

  • IntelliSense Fixes
    • Now handles Collection<TValue>, Iterator<TInner> correctly.
    • Undefined properties accessed with magic __get() are now reported with lower severity.
    • Fixed trait adaptation and class inheritance analysis. Classes with complex inheritance with trait use with adaptation are analysed correctly giving unseful insights about missing method implementation.
    • Fixed control-flow analysis of certain try/finally blocks.
    • Less falsy warnings for non-static methods called statically in case there is __callStatic() magic method.
    • match, fn, and interface are not reported as syntax errors when within a qualified name (PHP 8.0+).
    • Fixed a few type inferring cases.
    • Fixed reporting functions annotated with @ignore tag as unknown.
    • Type hinting through /** @var */ above if has been fixed.
    • Fixed check of define().
    • Fixed issue causing removal of new lines when formatting after abstract method.
    • Arrow functions now respect php.format.rules.spaceWithinDeclParens to add spaces within parentheses.
    • Fixed unwanted space when function is named as keyword.
    • Do not increase indentation if previous sibling node ends on the same line.
    • Fix of array items aligning when keys are not simple literals.
  • Refactoring
    • Trait function members are now resolved in semantic highlighting, finding references, code lenses with method overrides, and rename refactoring.
  • Stability Fixes
    • Memory leak when having .phar files in the solution has been fixed.