From b702dbf6dd8aa21514f509bf275cc379aea6b98c Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 14 Oct 2018 22:20:48 +0200 Subject: [PATCH] MDL-63422 lib: lessphp - review core loop / switch / case / continue --- lib/lessphp/Exception/Chunk.php | 20 ++++++++++---------- lib/lessphp/moodle_readme.txt | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/lessphp/Exception/Chunk.php b/lib/lessphp/Exception/Chunk.php index 97fce1b382f..b9f0a5e54db 100644 --- a/lib/lessphp/Exception/Chunk.php +++ b/lib/lessphp/Exception/Chunk.php @@ -67,7 +67,7 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ case 40: $parenLevel++; $lastParen = $this->parserCurrentIndex; - continue; + break; // ) case 41: @@ -75,18 +75,18 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ if( $parenLevel < 0 ){ return $this->fail("missing opening `(`"); } - continue; + break; // ; case 59: //if (!$parenLevel) { $this->emitChunk(); } - continue; + break; // { case 123: $level++; $lastOpening = $this->parserCurrentIndex; - continue; + break; // } case 125: @@ -96,10 +96,10 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ } //if (!$level && !$parenLevel) { $this->emitChunk(); } - continue; + break; // \ case 92: - if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; continue; } + if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; break; } return $this->fail("unescaped `\\`"); // ", ' and ` @@ -119,12 +119,12 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ $this->parserCurrentIndex++; } } - if ($matched) { continue; } + if ($matched) { break; } return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex); // /, check for comment case 47: - if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { continue; } + if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { break; } $cc2 = $this->CharCode($this->parserCurrentIndex+1); if ($cc2 == 47) { // //, find lnfeed @@ -145,14 +145,14 @@ class Less_Exception_Chunk extends Less_Exception_Parser{ return $this->fail("missing closing `*/`", $currentChunkStartIndex); } } - continue; + break; // *, check for unmatched */ case 42: if (($this->parserCurrentIndex < $this->input_len - 1) && ($this->CharCode($this->parserCurrentIndex+1) == 47)) { return $this->fail("unmatched `/*`"); } - continue; + break; } } diff --git a/lib/lessphp/moodle_readme.txt b/lib/lessphp/moodle_readme.txt index 95ea15ae0c4..fcfaf4b750a 100644 --- a/lib/lessphp/moodle_readme.txt +++ b/lib/lessphp/moodle_readme.txt @@ -8,6 +8,8 @@ All the files from the folder lib/Less are copied in this directory. Only exception made for the directory '.easymin' which is not included. +Verify that https://github.com/oyejorge/less.php/pull/367 has been applied to the imported version or apply it locally. + Also copy the license file from the project root. Licensed under the Apache license 2.0.