diff --git a/composer.json b/composer.json index eaa8e87b..3fbc7cec 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "psr-4": { "Leafo\\ScssPhp\\Test\\": "tests/" } }, "require": { - "php": "^5.4.0 || ^7" + "php": "^5.4.0 || ^7 || ^8.0" }, "require-dev": { "squizlabs/php_codesniffer": "~2.5", diff --git a/src/Compiler.php b/src/Compiler.php index d22d0a35..2fefccc1 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -2552,8 +2552,8 @@ protected function shouldEval($value) */ protected function reduce($value, $inExp = false) { - - switch ($value[0]) { + $switch = !empty($value) ? $value[0] : null; + switch ($switch) { case Type::T_EXPRESSION: list(, $op, $left, $right, $inParens) = $value; @@ -4373,7 +4373,7 @@ protected function sortArgs($prototype, $args) foreach ($args as $arg) { list($key, $value) = $arg; - $key = $key[1]; + $key = isset($key[1]) ? $key[1] : ''; if (empty($key)) { $posArgs[] = empty($arg[2]) ? $value : $arg; @@ -5889,7 +5889,7 @@ protected function libStrSlice($args) $start--; } - $end = (int) $args[2][1]; + $end = (isset($args[2][1]) ? (int) $args[2][1] : 0); $length = $end < 0 ? $end + 1 : ($end > 0 ? $end - $start : $end); $string[2] = $length