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

False positive error "global $PAGE cannot be used in block classes" #195

Closed dmitriim closed 2 years ago

dmitriim commented 2 years ago

I'm getting CI errors like global $PAGE cannot be used in block classes. Use $this->page. (moodle.PHP.ForbiddenGlobalUse.BadGlobal) in a class block_form class block_form extends \core\form\persistent

This doesn't look correct as basically we can't have any classes containing 'block'.

andrewnicols commented 2 years ago

Hi @dmitriim ,

Thanks for reporting this. It looks like the check is picking up any block class, even those which aren't the extending the moodleblock class.

stronk7 commented 2 years ago

Hi,

yeah, this is already reported @ moodlehq/moodle-cs#23 , so I'm closing it now. See you there!

Ciao :-)