A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://plugins.jetbrains.com/docs/intellij/php-open-api-breaking-changes-202.html below:

Incompatible PHP OpenAPI changes in PhpStorm 2020.2

Incompatible PHP OpenAPI changes in PhpStorm 2020.2 Union Types Support

PhpStorm 2020.2 introduced support for PHP union types, which resulted in some PSI-breaking changes.

In earlier versions, type hints in parameters, properties, and return types were parsed inconsistently:

As of PhpStorm 2020.2, class references with the question mark are uniformly wrapped into the PhpTypeDeclaration element, which is the parent for PhpReturnType, PhpFieldType, and PhpParameterType.

If your existing code fetches a class reference directly from the parent element, it is now required to get PhpTypeDeclaration first, and then call PhpTypeDeclaration#getClassReferences().

Before 2020.2:

private void handleParameterBefore(Parameter parameter) { ClassReference classReference = PsiTreeUtil.getChildOfType(parameter, ClassReference.class); handleReference(classReference); }

After 2020.2:

private void handleParameterAfter(Parameter parameter) { PhpTypeDeclaration typeDeclaration = PsiTreeUtil.getChildOfType(parameter, PhpTypeDeclaration.class); for (ClassReference classReference : typeDeclaration.getClassReferences()) { handleReference(classReference); } }

Deprecated PhpReturnType.getClassReference()

As of PhpStorm 2020.2, PhpReturnType.getClassReference() is deprecated, since there can be multiple class references. This method also became nullable, since in earlier versions an incomplete ? type was parsed just as a question mark, but now it is parsed as PhpTypeDeclaration with empty getClassReferences().

Before 2020.2:

private void handleReturnTypeBefore(PhpReturnType returnType) { ClassReference classReference = returnType.getClassReference(); handleReference(classReference); }

After 2020.2:

private void handleReturnTypeAfter(PhpReturnType returnType) { for (ClassReference classReference : returnType.getClassReferences()) { handleReference(classReference); } }

31 March 2023


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4