nitsua Hello,
Thank you for the question.
There is @suppress
doc comment tag you can use. More info and samples can be found on https://docs.devsense.com/en/vscode/problems#suppress-phpdoc-tag
Please let us know if it works for you.
nitsua Hello,
Thank you for the question.
There is @suppress
doc comment tag you can use. More info and samples can be found on https://docs.devsense.com/en/vscode/problems#suppress-phpdoc-tag
Please let us know if it works for you.
JakubMisek No, that is specifically for functions and classes only so it says. Im looking to do the same concept with any line of code, not just greatly limited to a function or a class.
nitsua I understand, something like
#suppress PHP0123
#endsuppress
It is on our to-do list, we don't support it yet.
Is there some warning, that is not correct? We can fix it.
JakubMisek That is unfortunate and seems like a pretty big oversight (just my opinion of course).. I was surely hoping it was there and would only be a single line comment like
// @php-ignore
// @ignore
// @ignore PHP0123, PHP4567
For example i have some code that creates defines dynamically
$thing = 'THING';
define(SOME_' . $thing .'_DEFINED', 'whatever');
Then anytime i use SOME_THING_DEFINED
it throws for undefined constants (assuming because it is not defined literally so it cant find it). Either way there are a few things where i do stuff with custom functions that it doesnt recognize as well. Having a simple way to ignore things would just be helpful. I dont really expect it to handle every possible thing a user can conjure up which is why i would have surely thought there was a way to ignore things.
I know projects are a lot of work and things get added as the developers get time and decide what they want to work on so i do appreciate the effort in the project and glad you have it on the roadmap at some point. I'll look for some other alternatives for now and maybe come back to this later down the road.
Thanks for the quick responses and answers as well!
nitsua thank you, it makes sense.
// @ignore
etc. apply just for the line below right?
JakubMisek Yes that is the idea, or even allow inline as well
$something = 'warning'; // @ignore
// @ignore-next
$something = 'ignored';
$something = 'checked';
// @ignore-start
$something = 'ignored';
$something = 'ignored';
// @ignore-end
$something = 'checked';
JakubMisek Any further thoughts on this by chance?
nitsua thank you for reminding me. We have it on our to-do but have not started it yet.
JakubMisek Just checking in as i still have lots of yellow "warnings" about code that shouldn't have warnings. Would be nice to be able to stop seeing them everywhere.
Is there a roadmap or timeline somewhere that can be followed? If it is still going to be months or years i will switch to something else (not the first choice) but i have no idea currently. I understand things get done when they get done, just looking for a way to keep myself updated.
Thanks.
nitsua thank you @nitsua for understanding!
We'd like to avoid reporting false-warnings in the first place.
I would recommend to disable specific warnings in your .vscode/settings.json
for now (https://docs.devsense.com/en/vscode/problems#phpproblemsexclude)
"php.problems.exclude" : {
"/" : [0123, 4567],
}
JakubMisek Unfortunately ignoring an entire thing such as all undefined constants is not a solution when the real issue is dynamic constants. I want to be told about them, just not the ones that are wrong. This same thing applies to classes it says do not exist but they do (composer loaded for example) so i dont want to ignore it outright.
I'll just do some hunting around for other things that might offer a way to ignore errors or even a different IDE entirely that is better for PHP
Thanks
nitsua Any IDE in general needs to "see" a declaration of class and constant you want to use.
A common approach is to have a generated file that defines your dynamic stuff, for example having a file
some-ide-helper.php
with generated content:
<?php
const DYNAMIC_CONST1 = 123;
/**
* @property int $a_property
*/
class DynamicClasss{}
the upcoming update will support
// phpcs:ignoreFile
// phpcs:ignore
// phpcs:disable
// phpcs:enable