Make sure to read this post before raising a thread here:
Inspection S1185 for PHP (Overriding methods should do more than simply call the same method in super class) generates false positive when the child only adds an attribute.
Example:
abstract class BaseFoo {
public function getFoo(): string { return 'foo'; }
}
class Foo {
#[\Deprecated]
public function getFoo(): string { return parent::getFoo(); }
}
Attributes can be used for a wild variety of things (validation, dependency injection changes etc…) and you may not be able to use them on the parent class (generated files, external dependencies etc…).
Welcome to the community and thanks for this report!
Your SonarQube Server is stale, but your SonarQube for IntelliJ version is current. Can you reproduce this in SQ4IDE in standalone / not-connected mode?
Your SonarQube Server is stale, but your SonarQube for IntelliJ version is current. Can you reproduce this in SQ4IDE in standalone / not-connected mode?
Yes I have the same issue on SQ4IDE that is not binded to a server. I could have specified this on the original post.
I’ve been trying to reproduce the issue with the provided reproducer code, but no issue is raised when using the latest SonarQube for IDE (v12.4.0.84870). Could you retry the latest plugin version? Also, please make sure to run the analysis in unbinded mode.
Hmm, could you try the reproducer code you provided in isolation and see if that exact code raises an issue?
Oh sorry, I forgot the extends BaseFoo in the original snippet. The snippet should be:
abstract class BaseFoo {
public function getFoo(): string { return 'foo'; }
}
class Foo extends BaseFoo {
#[\Deprecated]
public function getFoo(): string { return parent::getFoo(); }
}