We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With a parameter typed as ?SomeClass, class-constant lookups wrapped in an if are suggested to be replaced by null coalescing operator. e.g.:
?SomeClass
if
function foo(?Something $var = null): void { $fragment = null; if ($var) { $fragment = $var::PREFIX; } ... }
The suggested replacement is $var::PREFIX ?? null, but this produces a php error
$var::PREFIX ?? null
Don't suggest this replacement when the left side of the coalescing operator would be a class constant.
IntelliJ IDEA 2023.3 Beta (Ultimate Edition) Build #IU-233.11799.6, built on November 9, 2023 Licensed to IntelliJ IDEA EAP user: Stephen Reay Expiration date: December 9, 2023 Runtime version: 17.0.9+7-b1087.3 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.1.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 24 Metal Rendering is ON Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true Non-Bundled Plugins: com.jetbrains.plugins.ini4idea (233.11799.7) rocks.blackcat.vcl (0.7.2) net.sjrx.intellij.plugins.systemdunitfiles (223.230322.126) com.sburlyaev.terminal.plugin (0.6.0) com.intellij.plugin.applescript (0.121) org.jetbrains.plugins.ruby (233.11799.6) com.jetbrains.TabFormat (0.6) org.intellij.plugins.hcl (233.11799.7) com.intellij.apacheConfig (233.11799.7) name.kropp.intellij.makefile (233.11799.7) com.jetbrains.space (233.11799.10) org.jetbrains.plugins.vagrant (233.11799.6) com.jetbrains.php (233.11799.6) org.jetbrains.plugins.phpstorm-remote-interpreter (233.11799.6) com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0) de.espend.idea.php.annotation (9.4.0) com.intellij.php.psalm (233.11799.6) com.intellij.php.tools.quality.phpstan (233.11799.6) com.dwilden.crondescriptor (1.5) pro.bashsupport (3.3.4.233) org.asciidoctor.intellij.asciidoc (0.41.0) mobi.hsz.idea.gitignore (4.5.2) Pythonid (233.11799.6) ru.adelf.idea.dotenv (2023.3) Kotlin: 233-1.9.0-release-358-IJ11799.6
The text was updated successfully, but these errors were encountered:
Another case of what seems to be the same issue:
function test(?object $obj = null): string { return $obj ? $obj::class : '-'; }
Reproducible in EA Ultimate 2023.1
Sorry, something went wrong.
No branches or pull requests
Current behaviour
With a parameter typed as
?SomeClass
, class-constant lookups wrapped in anif
are suggested to be replaced by null coalescing operator. e.g.:The suggested replacement is
$var::PREFIX ?? null
, but this produces a php errorExpected behaviour
Don't suggest this replacement when the left side of the coalescing operator would be a class constant.
Environment details
IntelliJ IDEA 2023.3 Beta (Ultimate Edition)
Build #IU-233.11799.6, built on November 9, 2023
Licensed to IntelliJ IDEA EAP user: Stephen Reay
Expiration date: December 9, 2023
Runtime version: 17.0.9+7-b1087.3 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.1.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 24
Metal Rendering is ON
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Non-Bundled Plugins:
com.jetbrains.plugins.ini4idea (233.11799.7)
rocks.blackcat.vcl (0.7.2)
net.sjrx.intellij.plugins.systemdunitfiles (223.230322.126)
com.sburlyaev.terminal.plugin (0.6.0)
com.intellij.plugin.applescript (0.121)
org.jetbrains.plugins.ruby (233.11799.6)
com.jetbrains.TabFormat (0.6)
org.intellij.plugins.hcl (233.11799.7)
com.intellij.apacheConfig (233.11799.7)
name.kropp.intellij.makefile (233.11799.7)
com.jetbrains.space (233.11799.10)
org.jetbrains.plugins.vagrant (233.11799.6)
com.jetbrains.php (233.11799.6)
org.jetbrains.plugins.phpstorm-remote-interpreter (233.11799.6)
com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0)
de.espend.idea.php.annotation (9.4.0)
com.intellij.php.psalm (233.11799.6)
com.intellij.php.tools.quality.phpstan (233.11799.6)
com.dwilden.crondescriptor (1.5)
pro.bashsupport (3.3.4.233)
org.asciidoctor.intellij.asciidoc (0.41.0)
mobi.hsz.idea.gitignore (4.5.2)
Pythonid (233.11799.6)
ru.adelf.idea.dotenv (2023.3)
Kotlin: 233-1.9.0-release-358-IJ11799.6
The text was updated successfully, but these errors were encountered: