January 2023 (version 1.71)

Downloads: https://www.devsense.com/download
Purchase: https://www.devsense.com/purchase

Welcome to the December 2022 release of PHP Tools for Visual Studio!

Better PHP 8.2 and PHP 8.1 Support

  • enum and BackedEnum and UnitEnum implicit interfaces
  • readonly and enum parsed properly when used a part of the qualified name
  • updated integrated manual with the latest symbols and translations
  • support for the new Random extension
  • support for the new PHP 8.2 core types

IntelliSense & Enums

The PHP 8.1 enum objects implicitly implement UnitEnum and BackedEnum interfaces. The BackedEnum<TValue> interface is annotated with a template type argument so it can be used in Doc Comments with the backed type for better type analysis. E.g.:

/** @param \BackedEnum<string> $e */
function foo($e) {
    return $e->value // -> string
}

enum MyEnum : string {
    case A;
}

foo( MyEnum::A );

Improved Doc Comment Syntax

We've been working on recognizing the whole range of commonly used type syntaxes in Doc Blocks; now supporting most of PHPStan, and other popular linting frameworks.

Types, including complex array shapes, generic types, template type annotations, unions, intersections, and callables; are all not properly colorized, occurrences highlighted, and code completion works (even inside < and > when specifying generic type arguments). Refactoring recognizes nested types within Doc Blocks, and the overall functionality of types within Doc Blocks is complete now.

This release introduces more compatibility, and more features towards Doc Blocks, and related type analysis and code diagnostics.

Improved Generics and PHPStan Compatibility

  • supported the rest of @template, @implements-*, @extends-*, and other notations
  • generic types support overall improvements, more supported scenarios, working with doctrine/collections, etc.
  • core PHP Traversable types have been annotated with generic template type arguments
  • foreach works well with generic collections, Traversable types with generic annotations

PHPStan Array Shape, callable, list, and More

Since this release, the editor supports all the syntaxes for array shapes and callables. In addition, the type analysis handles specified PHPStan types accordingly.

PHPStan and Psalm array shapes specified in PHP Doc Comments are allowed, parsed, colorized, and used in code completion and type analysis.

Additionally, list and non-empty-list types are handled as well. Including their generic counterparts with < and > types specified.

All the callable syntaxes in PHP Doc Comments are supported now as well.

Array Shape Types Supported

  • doc comments allow using single-line structured array types in form of array{ key: type, }

More Generic Annotations

This update brings the standard types annotated with generic template types; this is especially helpful in Laravel and Symfony frameworks, where it provides type inferring for all the collections, iterables, Generator, DOMNodeList, etc.

This improves value inferred within foreach for all kinds of iterables.

Editor Enhancements

  • tool-tips show resolved generic types
  • stub-only phar packages (.phar with only the main stub, no file entries) are supported
  • blade files do not report falsy warnings
  • generated doc comments (/**) respect Generator functions
  • memory use optimizations
  • overall type inferring improvements and fixes
  • PHPStan doc comment type syntaxes supported and improved
  • avoids several falsy warnings
  • integer, boolean, list types are handled properly in Doc Block.
  • Unused use analysis is fixed, so it handles type names specified in Doc Blocks.
  • Diagnostic and parameter completion for session_set_cookie_params() works for both possible definitions.
  • Missing Imagick constants added.
  • Improves type inferring for generic types and various edge cases.

Automatic Installations

We've updated most of the PHPs and Xdebug libraries which are installed automatically to their latest versions. We now also offer PHP 8.2 release to be installed with Xdebug 3.2.0.

We've also fixed an issue that prevented from automatically installing at all.