

PhpStorm highlights incorrect usages and takes type inference into account. It is widely used in the standard library, see strpos() or array_search(), for example, and can be applied elsewhere to indicate a negative result.

PhpStorm highlights these violations and provides an Alt+Enter quick-fix to convert them. But when there are multiple types combined with null, using ?Type1|Type2 is forbidden as ambiguous. Work with nullable types - When there is a single nullable type, it is allowed to use either ?Type notation or Type|null in PHP 8.Detect duplicate and redundant types - There are many type combinations that are forbidden or redundant.PhpStorm will highlight places that require attention even before the code is run. In complex code bases, it helps you see the problems at first glance. The checks work on all levels: properties, arguments, and return values. Perform type validation - PhpStorm analyzes calls, calculates possible types, and highlights problem areas relating to union types.Specify the PHP version requirement in composer.json, and PhpStorm will pick it up automatically.Go to Preferences | Languages & Frameworks | PHP and use the PHP language level list.Use the Alt+Enter quick-fix directly in the code editor.

Switch Language Level to PHP 8 - To enable the PHP 8 related features, switch the language level to PHP 8 in any of the following ways:.

Convert PHPDoc to native union types - Union types used to be provided via PHPDoc, and now PhpStorm highlights such occurrences.Fixed issue with “Extract class” when refactoring messes up return types of fluent methods.Fixed issue with missing return type declaration when quick-fix adds the return type before ‘use’ in closures.Fixed issue with unused import false positive when using parent FQCN as child class namespace.Fixed issue with trait collision false positive when using insteadof conflict resolution.Fixed issue when method argument is not highlighted when cursor is on a variable in the method body.Yarn2: Added the ability to navigate from Yarn library in Project View to package.json.Added the ability to automatically exclude.Added the ability to import default Prettier rules to the Vue and HTML code style.Angular: Added support type inference for structural directives on ng-template tag.Added attributes arrangement for Vue.js.Added separate "Structural Search" inspections based on language.Added a new missing parameter type inspection.
