PHP Tools for Visual Studio v1.6x

Released: Jan 31, 2022

Updates in v1.6x

v1.69.16464

Updated Oct 13, 2022

Features

  • Interface and Enum Colors - The PHP Editor now respects Microsoft Visual Studio colors for Interface and Enum.
  • New Diagnostics - Added and updated several code diagnostics:
    • Added new PHP 8.2 compatibility diagnostics.
    • There is now a diagnostic for the invalid use of break; or continue when they are out of the allowed scope.
    • Diagnostic of function return has been improved in cases where there is a mixed type hint, but the function does not return anything.
    • Unknown properties now get reported.
      • Additionally, there is a new quick fix for unknown property, if there is a typo in the name.
      • stdClass and classes with __get() magic method are now ignored (as specified in the PHP 8.2 RFC).
    • Dynamic properties are now reported if there isn't a corresponding __get/__set, or @property annotation.
    • Duplicate field declaration is now reported.
    • Duplicate class constant declaration is now reported.
    • foreach control variables can now be annotated with a DocBlock.
    • Reporting anonymous functions with unused use variables.
    • Reporting empty namespaces.
    • Checking that value from a function returning void is being used.
    • Reports accessing a property on void.
    • Checks expressions in string interpolation are convertible to string.
    • Checks that type of a property is defined.
    • Checks if too many arguments passed to a function.
    • Added a check for duplicate modifiers in function, property, or constructor property declaration.

Fixes

  • Fixed return type check when type hint is void.
  • Fixed the incorrect duplicate key check in the case of enum' case values.
  • Fixed code analysis not getting results when there was a specific case of recursion.
  • Publishing handles case, when deleted file was already deleted on the server.
  • Fixed internal error in Code Lenses, when a file is opened outside the project.
  • Fixed color of @ inside Doc Comment incorrectly recognized as a PHPDoc keyword.
  • Diagnostic of code reachability with try/finally has been fixed.
  • Reporting anonymous function' use variable is not initialized.

v1.68.16325

Updated Sep 18, 2022

Features

  • Added support for PHP 8.2.
  • Diagnostics:
    • Dynamic Properties - The editor now checks accessing class dynamic properties, i.e. properties that were not declared, according to their access.
    • Annotating 'foreach' Control Variables - The type of control variables can now be annotated using 'inlined DocComment'. The same works for the key variable as well.
    • More Control Flow Diagnostics - In cases where a function has a mixed return type-hint, the missing return is now reported.
  • Debug Improvements:
    • Array item types are shown - When inspecting arrays, the debugger determines the type of array items and shows the array object more conveniently.
    • Editing private properties - You can now change a value of a private property during debugging session.
    • Publish Log Level - Added a log level setting to publish profiles. Turn on 'Diagnostic' log level to find out what exactly is going on during the publishing process - detailed information will be written to 'Publish' output pane.
  • Improvements:
    • Updated Attribute class definition.
    • Generated getter/setter snippet (through a property code action) now respects static keywords.
    • DocComments now allow type hints to be enclosed in parentheses.
    • Memory usage optimizations.
    • Performance improvements.

Fixes

  • Debug:
    • Debug expression evaluation has been fixed.
  • Other Fixes:
    • Fixed colorization of attributes (#[]) above enum cases.

v1.67.16259

Updated Aug 29, 2022

Features

  • Added support for bracket pair colorization for PHP code.

v1.67.16210

Updated Aug 15, 2022

Features

  • To-Do on Dark Theme - Improved and updated the color scheme of to-do comments on Dark Theme. It makes caret navigation more readable.
  • IntelliSense Enhancements - Code Completion has several new features and improvements to make daily tasks easier:
    • More precise static type resolve, especially when defined in trait.
    • Code analysis and type checks have also been added for variadic parameters.
    • Tooltips now shows cleaner information.
    • Overall improvements in type analysis.
    • Improved resolving corresponding __construct.
    • Auto-import use now respects the already existing alias with the same name. Auto-Importing of a namespace avoids creating conflict names in use and current class.
  • Code Diagnostics:
    • Strict Types Checking - The code diagnostic now respects the strict_types directive. Whenever there is declare(strict_types=1); code at the top of the source file, implicit numeric conversions are now treated strictly. Any conversion that would reduce the value precision is reported as a warning.
    • Unknown Property Diagnostic and Code Fix - The code diagnostic for unknown properties has been introduced. In case there is no magic __get() method, and it is not a stdClass, the unknown property is reported in the editor, and the error list. Eventually, a quick code action is now provided, allowing you to quickly insert the correct property name, if it can be inferred at the moment. The quick code action fixes common typos and fixes letter casing.
    • Namespace Declaration Correctness - Added a code diagnostic that validates the use of namespace and other statements in the global code. It also checks the user is not mixing short and long namespace syntaxes.
    • Class Name Correctness - There must not be the same class names defined. The editor was already checking for that. Now it also checks aliases introduced with use statement in combination with classes inside the current namespace. This reports names of classes conflicting with a name already specified in a use alias.
    • Code Compose - Added new Code Compose feature in the PHP Editor. It is also known as inline suggestion. The editor now guesses the next word or a sequence of words you might type according to the context. The suggestion is shown dimmed right in the code and can be confirmed with TAB key.

Fixes

  • PHP 8.1 enums are now correctly handled.
  • Variadic parameters are now handled correctly.
  • Fixes in the case of trait aliased methods.
  • Not reporting correctly used $this in template files.
  • Unused use not reported twice.
  • Fixed word occurrence highlighting stopped working.
  • Ctrl+F5 (run without debug) allows ignoring issues about Xdebug.
  • F12 (go to def) on an include/require navigates to the file.
  • Several localized texts have fixed punctuation.
  • Fixed code completion exception on Visual Studio 2022 (17.3.0 with IntelliCode).
  • Memory optimizations.
  • Internal fixes.

v1.66.15908

Updated Jun 25, 2022

Features

  • Code Lens - Added Code Lenses for PHP code. This feature helps with navigating through definitions and references. Code Lenses are displayed above each function, class, interface, trait, enum, and properties. This shows the number of references and implementations. For overridden methods, it also provides a quick link to the parent definition (displayed as prototype).
  • Generic class-string<T> - There is a special syntax used in Documentary Comments to annotate a variable, which value should be a name of a class. It's usually used by code linters like PHPStan or Psalm. PHP Tools now use this annotation in combination with the support for generics. Parameters annotated with class-string<T>, where T is a template argument, allows the editor to infer the type of T when possible.
  • Laravel Real-Time Facades - The editor now recognizes real-time facades, and provides code analysis, code completion, and overall IntelliSense for them. Each class name which is prefixed with Facades\ is treated as a real-time facade (in case there are Laravel Facades included in the project).
  • Eloquent Local Scopes - Added initial support for Eloquent's Local Scopes, i.e. functions prefixed with scope in the Eloquent Model. Those functions show up in the IntelliSense without the prefix as both static and non-static with its scoped arguments. The editor scans for the local scopes (the functions prefixed with scope on a class that implements Illuminate\Database\Eloquent\Model or on a trait that is used within a Model class). Such functions are displayed in the IntelliSense and are also recognized by the code analysis.
  • Debug Notices and Warnings - PHP notices and warnings sometimes slide unnoticed. They are now displayed in the Debug Output Pane.

Fixes

  • Fixed crashing Visual Studio 2022 when saving a file in a Folder project.
  • Visual Studio startup avoids blocking UI when Visual Studio is loading and avoids showing of the yellow notification bar.
  • Installer ensures there is .NET SDK installed, otherwise PHP projects won't work properly.
  • PHP 8.1 constants dereferencing -> supported, and not reported as syntax error anymore.
  • Completion after -> with new in the expression chain.
  • Fixed issue when debug inlines may cause debugging to sporadically start.
  • Fixed highlighting of unused use when it is actually used in an Doc Comment which is not associated with anything.
  • Fixed debugging when the product license is not activated.
  • Fixed UI of the Project Issues window on Visual Studio's 2022 dark theme.
  • Fixed internal error causing IntelliSense to show nonsense.
  • Fixed Test Explorer discovery for tests annotated with @test Doc Comment.
  • Fixed Go To Definition (F12) on PHP manual symbols.

v1.65.15697

Updated May 27, 2022

Features

  • Debug Inlines - Added a new insight while debugging your code - displaying debug inlines. Debug inlines are displayed in gray italic at the end of a line. It shows the values of variables and expressions based on the current debugging context. Usually function parameters, loop variables, and expressions read in the current statement.
  • Highlighting ToDo - Added the ability to highlight single line comments //TODO:, #TODO, or @todo within documentary comments.
  • Improvements:
    • Parsing type hints from documentary comments now respects more psalm and phpstan conventions.
    • Memory use optimizations.
    • Improved use of templated type arguments.
    • Completion and tooltips now show templated type arguments.

Fixes

  • Fixed rare cases of invalid type inferring analysis.

v1.64.15602

Updated Apr 29, 2022

Features

  • Generic Types - The syntax for generics is now fully supported. This improves eventual code completion and code refactoring wherever the generic types are either specified or inferred by the editor.
  • Generic PHPDoc Syntax - Additional documentary tags and keywords are now recognized. This includes the following tags:
    • @template annotates a class/interface/trait or a function generic argument.
    • @extends allows you to specify generic types for a base class.
    • @implements specifies generic types for base interfaces.
    • @use specifies generic types for the used trait.
    • The corresponding variations prefixed with @psalm- or @phpstan-, which basically means the same.
  • Completion After Generics - The generic arguments are now respected by the code analysis and IntelliSense. Wherever possible, they are substituted with the inferred types.
  • Infer Generic Types from Constructor - Generic types can now be inferred from the class constructor. The editor matches values provided to the constructor against the class generic arguments and resolves them.
  • Laravel Collections and Doctrine Collections - Since Laravel 9, most of the classes are annotated with @template tags, allowing the editor to provide better code completion. This release of PHP Tools allows to use Laravel generic types as well.
  • Generic Types in Tool Tips - Generics are now also shown in the corresponding tool-tips, so it is obvious what types were annotated and substituted.
  • Supports Psalm and PHPStan names - The PHPDoc tags prefixed with @psalm- and @phpstan- are now supported, and the special types that might be used within those tags are now properly parsed.
    • This includes generic types syntax, arrays with specified element types, specialized type names such as non-empty-array, class-name, etc.
  • Other Improvements:
    • Debug output no longer contains unimportant internal messages.
    • Debug exception handling has been improved, when there is a syntax error, full CallStack is displayed.
    • Improved IntelliSense completion pre-selection.
    • Updated PHP and Xdebug distributions.

Fixes

  • Fixed deleting files on a remote server; if the file is already deleted, the operation continues successfully.
  • Fixed debugging with JS debugging enabled.
  • Minor project system fixes.

v1.62.15410

Updated Mar 6, 2022

Features

  • Editor
    • Adding use is Sorted - The editor now inserts use statements for you; either from a code action over a class name, or when completing a class that is not imported in the current file yet. Whenever the new use is inserted by the editor, either as an auto-import by code completion or from a code action, the editor inserts it within the existing uses block in order, sorted alphabetically. This behavior even respects function and const aliases by grouping them together.
    • Laravel Facades - The editor now recognizes built-in and custom facades, it recognizes the facade accessor service and it recognizes defined services as well. The editor also scans the workspace for laravel class aliases defined in config/app.php file.
    • IntelliSense & ORM - IntelliSense has been improved and the integrated multi-language manual has been updated. Code analysis now takes ORM (Object-Relational-Mapping) attributes from doctrine framework into account, and type information from PHPDoc is combined with the type hints.
    • IntelliSense and @ignore tag - Functions annotated with @ignore PHPDoc tag are actually now ignored by IntelliSense. This is used heavily in WordPress; since this release, dummy WordPress functions are not shown in IntelliSense making the development of WordPress themes and plugins better.
  • Workspace
    • Added more debugging options for the Microsoft Visual Studio's Open Folder features. Without creating regular projects in Visual Studio, it is now possible to simply open a folder, and get most of the features for PHP development.
    • IntelliSense, debugging, and Test Explorer are fully supported in folder workspaces now. By default, there are launch options to:
      • Listen for Xdebug.
      • Start and Debug built-in web server.
      • Start and Debug current .php document as a CLI script.
      • All these launch options are configurable through Visual Studio's launch settings.
  • Improvements
    • Added more details in the built-in PHP manual.
    • Updated built-in PHP manual.
    • Updated translations of the built-in PHP manual.
    • Generated PHPDoc for properties now respect its type hint.
    • IntelliSense and code analysis now combines PHPDoc types and type-hint information.
    • Added more detailed IntelliSense for deprecated functions and classes.
    • IntelliSense and tool-tips now show the correct version of implode function.

Fixes

  • Stability fix for too large solutions (StackOverflowException).
  • Some PHAR files were not visible in IntelliSense.
  • Fixed smart indentation after PHP 8 attributes #[].
  • Debugger stability fixes.
  • Debugger shows stack traces of unhandled exceptions.
  • IntelliSense respects PHPDoc that are followed with PHP 8 attributes.

v1.61.15241

Updated Feb 11, 2022

Features

  • PHP 8.1 readonly properties without a type hint are reported as fatal error since the type is required.
  • Improved code parser performance.

Fixes

  • (VS 2019) Context menu command "Publish" fixed.
  • Debugger evaluating empty arrays fix.
  • Twig editor stability improvements.
  • Fixed generated PHPDoc code when previewing built-in PHP functions.
  • Fixed slow opening (editor frozen for minutes) of certain PHP files.
  • Editor stability fix.
  • Word highlighting and Find All References resolves primitive type names correctly.
  • Fixed crash on non-English Visual Studio installations.
  • Fixed IntelliSense not seeing any symbols.

v1.60.15188

Updated Jan 31, 2022

Features

  • The public web folder has been annotated with a "wwwroot" icon.
  • Project properties and context menu no longer show unnecessary menu items.
  • Editor
    • Added checks for correct use of the new PHP 8.1 intersection types.
    • Improved code completion - faster completion, better pre-selection of completion items.
    • Improved analysis of missing abstract method implementation.
    • Added the ability to automatically rename a class when a corresponding file gets renamed in the new project system (common project system).
    • Accessibility keywords have been added to code completion within function headers.

Fixes

  • Running CLI project uses command-line arguments specified on the project properties page.
  • Fixed crash in VS 2022 when user clicks at the php.ini link on the project properties page.
  • Fixed possible deadlock upon opening a project.
  • Fixed composer info-bar with missing packages information and quick action to "install" them.