Skip to content

Commit

Permalink
Merge pull request #176 from stronk7/comma_separated_use
Browse files Browse the repository at this point in the history
Avoid comma-separated use statements to require MOODLE_INTERNAL
  • Loading branch information
stronk7 committed Jan 21, 2022
2 parents 9708c27 + 2f2ba6c commit efb86bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion moodle/Sniffs/Files/MoodleInternalSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected function get_position_of_relevant_code(File $file, $pointer) {
$pointer = $file->findNext($ignoredtokens, $pointer, null, true);
if ($tokens[$pointer]['code'] === T_NAMESPACE || $tokens[$pointer]['code'] === T_USE) {
// Namespace definitions are allowed before anything else, jump to end of namspace statement.
$pointer = $file->findEndOfStatement($pointer + 1);
$pointer = $file->findEndOfStatement($pointer + 1, T_COMMA);
} else if ($tokens[$pointer]['code'] === T_STRING && $tokens[$pointer]['content'] == 'define') {
// Some things like AJAX_SCRIPT NO_MOODLE_COOKIES need to be defined before config inclusion.
// Jump to end of define().
Expand Down Expand Up @@ -321,6 +321,7 @@ private function code_changes_global_state(File $file, $start, $end) {
continue;
}


// Ignore function/class prefixes.
if (isset(Tokens::$methodPrefixes[$tokens[$i]['code']]) === true) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
namespace mod_workshop\plugininfo;

use core\plugininfo\base;
use core\plugininfo\this,
core\plugininfo\that;
use core\plugininfo\one, core\plugininfo\two,core\plugininfo\three;

class workshopallocation extends base {
public function is_uninstall_allowed() {
Expand Down

0 comments on commit efb86bd

Please sign in to comment.