Have a look at MDLSITE-5967 and coding style: Sometimes the MOODLE_INTERNAL check is simply not necessary, so you get the hint to drop the line.
General developer forum
Unexpected MOODLE_INTERNAL check ???
གྲོས་བསྟུན་འདི་བསྡམས་ཡོདཔ་ལས་ ལན་གསལ་བརྐྱབ་མི་ཚུགས་