diff --git a/moodle/Sniffs/Files/MoodleInternalSniff.php b/moodle/Sniffs/Files/MoodleInternalSniff.php index fdd239b..4ec3aaf 100644 --- a/moodle/Sniffs/Files/MoodleInternalSniff.php +++ b/moodle/Sniffs/Files/MoodleInternalSniff.php @@ -166,6 +166,9 @@ protected function get_position_of_relevant_code(File $file, $pointer) { } else if ($tokens[$pointer]['code'] === T_DECLARE && $tokens[$pointer]['content'] == 'declare') { // Declare statements must be at start of file. $pointer = $file->findEndOfStatement($pointer + 1); + } else if ($tokens[$pointer]['code'] === T_ATTRIBUTE) { + // Attribute statements must be at start of file. + $pointer = $tokens[$pointer]['attribute_closer'] + 1; } else { $relevantcodefound = true; }