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 ???
הדיון ננעל, כך שלא ניתן יותר להגיב אליו.