July 2023 (version 1.74)
Downloads: https://www.devsense.com/download
Purchase: https://www.devsense.com/purchase
Welcome to the July 2023 release of PHP Tools for Visual Studio!
IntelliPHP
Introducing AI-powered inline code predictions enhancing productivity and code development experience for PHP. IntelliPHP leverages machine learning to provide intelligent code predictions. As you type, the extension suggests relevant code completions and shows them as grey 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. To disable/enable the feature, go to
Tools
/Options
,Text Editor
/PHP
/IntelliPHP
.
The feature is only available to Visual Studio 2022 (and future versions).
New IntelliSense Features
IntelliSense & IteratorIterator
IteratorIterator
and RecursiveIteratorIterator
are 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. (#1613)
IntelliSense & @phpstan-type
, @psalm-type
, @phpstan-import-type
Since now, we have a basic support for local type aliasing.
IntelliSense & Traits with Generics
Newly, trait
use can be annotated with @use
doc comment to specify the trait's generic arguments (#840), i.e.:
class MyClass {
/** @use MyTrait<int, string> */
use MyTrait;
}
IntelliSense & static
Type
We have reimplemented 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 resolved better with more inherited type information (#931).
Other IntelliSense Features
@phpstan-type
and@phpstan-import-type
are supported (#1543).phpstan.neon
(and.dist
alternatives) in containing directories processed; supporting their global type aliases (phpstan.neon
file's"typeAliases"
setting).- Handling
Collection<TValue>
,Iterator<TInner>
correctly. - Undefined properties accessed with magic
__get()
reported with lower severity. - Fixes 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. - Fixes control-flow analysis of certain
try
/finally
blocks. - Improves Laravel IntelliSense.
- Type inferring in the context of
is_a()
analyzed correctly. - Less falsy warnings for non-static methods called statically in case there is
__callStatic()
magic method. - New quick refactorings through code actions.
- Updated integrated PHP manual and localizations.
match
,fn
, andinterface
are not reported as syntax errors when within a qualified name (PHP 8.0+).- PHP 8.2 standalone
true
,false
, andnull
type names. (#338) - Fixed a few type inferring cases.
- Fixed reporting functions annotated with
@ignore
tag as unknown. - Type hinting through
/** @var */
aboveif
fixed. - Fixed check of
define()
. (#340) - Fixed issue causing removal of new lines when formatting after abstract method. #1525
- Arrow functions now respect php.format.rules.spaceWithinDeclParens to add spaces within parentheses. #1536
- Fixed unwanted space when function is named as keyword #335
- Do not increase indentation if previous sibling node ends on the same line #333
- Fix of array items aliging when keys are not simple literals #1602
Refactoring
Trait function members are resolved in semantic highlighting, finding references, code lenses with method overrides, and rename refactoring.
Formatting
We have reimplemented 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, we ensure that the resulting code is well-formatted and also resolves issues reported by our users, such as #1577 and #1587.
Stability Fixes
- Memory leak when having
.phar
files in the solution has been fixed.