@@ -47,7 +47,6 @@ class local_moodlecheck_file {
4747 protected $ allphpdocs = null ;
4848 protected $ variables = null ;
4949 protected $ defines = null ;
50- protected $ constants = null ;
5150
5251 /**
5352 * Creates an object from path to the file
@@ -72,7 +71,6 @@ protected function clear_memory() {
7271 $ this ->allphpdocs = null ;
7372 $ this ->variables = null ;
7473 $ this ->defines = null ;
75- $ this ->constants = null ;
7674 }
7775
7876 /**
@@ -518,47 +516,6 @@ public function &get_variables() {
518516 return $ this ->variables ;
519517 }
520518
521- /**
522- * Returns all constants found in file
523- *
524- * Returns array of objects where each element represents a constant:
525- * $variable->tid : token id of the token with variable name
526- * $variable->name : name of the variable (starts with $)
527- * $variable->phpdocs : phpdocs for this variable (instance of local_moodlecheck_phpdocs or false if not found)
528- * $variable->class : containing class object
529- * $variable->fullname : name of the variable with class name (i.e. classname::$varname)
530- * $variable->boundaries : array with ids of first and last token for this constant
531- *
532- * @return array
533- */
534- public function &get_constants () {
535- if ($ this ->constants === null ) {
536- $ this ->constants = [];
537- $ this ->get_tokens ();
538- for ($ tid = 0 ; $ tid < $ this ->tokenscount ; $ tid ++) {
539- if ($ this ->tokens [$ tid ][0 ] == T_USE ) {
540- // Skip the entire use statement, to avoid interpreting "use const" as a constant.
541- $ tid = $ this ->end_of_statement ($ tid );
542- continue ;
543- }
544-
545- if ($ this ->tokens [$ tid ][0 ] == T_CONST && !$ this ->is_inside_function ($ tid )) {
546- $ variable = new stdClass ;
547- $ variable ->tid = $ tid ;
548- $ variable ->fullname = $ variable ->name = $ this ->next_nonspace_token ($ tid , false );
549- $ variable ->class = $ this ->is_inside_class ($ tid );
550- if ($ variable ->class !== false ) {
551- $ variable ->fullname = $ variable ->class ->name . ':: ' . $ variable ->name ;
552- }
553- $ variable ->phpdocs = $ this ->find_preceeding_phpdoc ($ tid );
554- $ variable ->boundaries = $ this ->find_object_boundaries ($ variable );
555- $ this ->constants [] = $ variable ;
556- }
557- }
558- }
559- return $ this ->constants ;
560- }
561-
562519 /**
563520 * Returns all 'define' statements found in file
564521 *
0 commit comments