moodlehq / moodle-local_codechecker

A Moodle local plugin providing a simple web UI to run the MoodleCS coding style checks with PHP_CodeSniffer.
63 stars 72 forks source link

Allow use of inline /** @var syntax #227

Closed andrewnicols closed 7 months ago

andrewnicols commented 8 months ago

We should support inline use of:

/** @var [type] */
stronk7 commented 8 months ago

Uhm... not sure if that corresponds here. I think (possible memory fault) that moodlecs already supports those inline phpdocs, when the next line is an assignment and a few more cases (loops come to my brain).

That was implemented long ago to allow IDEs to behave better, although the recommendation is to use them only when really needed.

stronk7 commented 8 months ago

Yeah, looking to commits, I found a couple of issues where it was implemented:

And it matches the coding style, about allowed "type hinting" phpdoc blocks, that was decided @ https://tracker.moodle.org/browse/MDLSITE-2322.

So, maybe all you need in the case above is to add the name of the variable, so moodle-cs can do its work and match it with the next code line (assignment, loop or list)?

Ciao :-)

stronk7 commented 7 months ago

I'm closing this now. As said, moodle-cs already manages that if the comment includes the name of the variable and, in any case moodle-cs is the place to discuss about that.

Ciao :-)