vscode-intelephense
vscode-intelephense copied to clipboard
Add setting to disable Non static method '' should not be called statically.

I have the __callStatic method, But it still prompts me a lot of info information, I don't think this should be prompted. Intelephense version 1.4.0 php version 7.4.0
Can you provide a code example that reproduces the problem? Is startTrans static or non-static? If it is declared non-static then I think this is valid diagnostic even if you have __callStatic.

the startTrans is non-static,
Can this info be shut down? I think it's a little annoying
This diagnostic is current bundled in with others under intelephense.diagnostics.languageConstraints . Will look at separating it out.
I think this option should be added, and the default is off state
@bmewburn
intelephense.diagnostics.languageConstraints
Thank you for the suggestion, it worked. I have a question, though: is there a "documented way" to find out which certain option helps to disable this or that Warning/Notice? Maybe, display it in the error message itself, like:
Non static method 'builder' should not be called statically.intelephense(1036) You can disable this kind of messages via "intelephense.diagnostics.languageConstraints" option
Something like this.
This becomes very annoying.
Any updates on this?
I had a similar issue and it turned out it was the file size limitation for Intelephense, causing it not to index the IDE helper files. The output tab showed this:
[Warn - 22:40:21] file:///home/foo/my/project/_ide_helper.php is over the maximum file size of 1000000 bytes.
Just changed the Intelephense › Files: Max Size setting and all was good after.
Calling non static methods statically has been a fatal error since php 8.0 (which was EOL 11/2023) and a deprecated warning before that. Closing as I don't see a good reason for the need to suppress this. Individual errors can still be suppressed with /** @disregard P1036 */.
Unfortunately, this issue has resurfaced in version 1.12.3. The problem is caused by PHP magic functions, which are not recognized by Intelephense
yes same here, cannot disable it.
the commit you've added to this thread did not fix this issue, and the problem still exists in 1.12.5
the commit you've added to this thread did not fix this issue, and the problem still exists in 1.12.5
Yeah that was a mistake, I didn't release adding a url to a commit linked it to the issue. You learn something new every day...
And yes, it didn't even fix it!
What an annoying question!
It is still there?
I'm using v1.12.6 and PHP 8.3.14 and PHP doesn't throw fatal errors for the below implementation. Is it possible to add a suppression comment at the top of a file to ignore /** @disregard P1036 */ for the whole file? I have many database calls like the example and it's hard to see any real errors.
__callStatic() implementation
Thank you.
This error will be suppressed in cases where __callStatic is declared in next release.
Thank you!
Do I need to know if it's solved?
Still appears to be an issue today with 1.12.6.
Can confirm this on the latest version of both.
Try the pre-release