From 39cd933ebbf7cf59a6b1f2fad2a391b5064dca66 Mon Sep 17 00:00:00 2001 From: acognet Date: Tue, 28 Jun 2022 12:03:01 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05108=20-=20Update=20embedded=20libs=20fo?= =?UTF-8?q?r=20PHP=208.0=20(3.0=20branch)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/scssphp/scssphp/phpcs.xml.dist | 12 +++ lib/scssphp/scssphp/src/Block/AtRootBlock.php | 37 ++++++++ .../scssphp/src/Block/CallableBlock.php | 45 +++++++++ .../scssphp/src/Block/ContentBlock.php | 38 ++++++++ .../scssphp/src/Block/DirectiveBlock.php | 37 ++++++++ lib/scssphp/scssphp/src/Block/EachBlock.php | 37 ++++++++ lib/scssphp/scssphp/src/Block/ElseBlock.php | 27 ++++++ lib/scssphp/scssphp/src/Block/ElseifBlock.php | 32 +++++++ lib/scssphp/scssphp/src/Block/ForBlock.php | 47 +++++++++ lib/scssphp/scssphp/src/Block/IfBlock.php | 37 ++++++++ lib/scssphp/scssphp/src/Block/MediaBlock.php | 37 ++++++++ .../scssphp/src/Block/NestedPropertyBlock.php | 37 ++++++++ lib/scssphp/scssphp/src/Block/WhileBlock.php | 32 +++++++ lib/scssphp/scssphp/src/CompilationResult.php | 69 ++++++++++++++ .../scssphp/src/Compiler/CachedResult.php | 77 +++++++++++++++ .../scssphp/src/Exception/SassException.php | 7 ++ .../src/Exception/SassScriptException.php | 32 +++++++ .../scssphp/src/Logger/LoggerInterface.php | 48 ++++++++++ .../scssphp/src/Logger/QuietLogger.php | 29 ++++++ .../scssphp/src/Logger/StreamLogger.php | 62 ++++++++++++ lib/scssphp/scssphp/src/OutputStyle.php | 9 ++ lib/scssphp/scssphp/src/Util/Path.php | 77 +++++++++++++++ lib/scssphp/scssphp/src/ValueConverter.php | 95 +++++++++++++++++++ lib/scssphp/scssphp/src/Warn.php | 84 ++++++++++++++++ 24 files changed, 1044 insertions(+) create mode 100644 lib/scssphp/scssphp/phpcs.xml.dist create mode 100644 lib/scssphp/scssphp/src/Block/AtRootBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/CallableBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/ContentBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/DirectiveBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/EachBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/ElseBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/ElseifBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/ForBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/IfBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/MediaBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php create mode 100644 lib/scssphp/scssphp/src/Block/WhileBlock.php create mode 100644 lib/scssphp/scssphp/src/CompilationResult.php create mode 100644 lib/scssphp/scssphp/src/Compiler/CachedResult.php create mode 100644 lib/scssphp/scssphp/src/Exception/SassException.php create mode 100644 lib/scssphp/scssphp/src/Exception/SassScriptException.php create mode 100644 lib/scssphp/scssphp/src/Logger/LoggerInterface.php create mode 100644 lib/scssphp/scssphp/src/Logger/QuietLogger.php create mode 100644 lib/scssphp/scssphp/src/Logger/StreamLogger.php create mode 100644 lib/scssphp/scssphp/src/OutputStyle.php create mode 100644 lib/scssphp/scssphp/src/Util/Path.php create mode 100644 lib/scssphp/scssphp/src/ValueConverter.php create mode 100644 lib/scssphp/scssphp/src/Warn.php diff --git a/lib/scssphp/scssphp/phpcs.xml.dist b/lib/scssphp/scssphp/phpcs.xml.dist new file mode 100644 index 000000000..b162dbd6b --- /dev/null +++ b/lib/scssphp/scssphp/phpcs.xml.dist @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/lib/scssphp/scssphp/src/Block/AtRootBlock.php b/lib/scssphp/scssphp/src/Block/AtRootBlock.php new file mode 100644 index 000000000..41842c269 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/AtRootBlock.php @@ -0,0 +1,37 @@ +type = Type::T_AT_ROOT; + } +} diff --git a/lib/scssphp/scssphp/src/Block/CallableBlock.php b/lib/scssphp/scssphp/src/Block/CallableBlock.php new file mode 100644 index 000000000..a18a87c2a --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/CallableBlock.php @@ -0,0 +1,45 @@ +type = $type; + } +} diff --git a/lib/scssphp/scssphp/src/Block/ContentBlock.php b/lib/scssphp/scssphp/src/Block/ContentBlock.php new file mode 100644 index 000000000..870849800 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/ContentBlock.php @@ -0,0 +1,38 @@ +type = Type::T_INCLUDE; + } +} diff --git a/lib/scssphp/scssphp/src/Block/DirectiveBlock.php b/lib/scssphp/scssphp/src/Block/DirectiveBlock.php new file mode 100644 index 000000000..b1d3d1a81 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/DirectiveBlock.php @@ -0,0 +1,37 @@ +type = Type::T_DIRECTIVE; + } +} diff --git a/lib/scssphp/scssphp/src/Block/EachBlock.php b/lib/scssphp/scssphp/src/Block/EachBlock.php new file mode 100644 index 000000000..b3289579d --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/EachBlock.php @@ -0,0 +1,37 @@ +type = Type::T_EACH; + } +} diff --git a/lib/scssphp/scssphp/src/Block/ElseBlock.php b/lib/scssphp/scssphp/src/Block/ElseBlock.php new file mode 100644 index 000000000..6abb4d775 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/ElseBlock.php @@ -0,0 +1,27 @@ +type = Type::T_ELSE; + } +} diff --git a/lib/scssphp/scssphp/src/Block/ElseifBlock.php b/lib/scssphp/scssphp/src/Block/ElseifBlock.php new file mode 100644 index 000000000..4622bca79 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/ElseifBlock.php @@ -0,0 +1,32 @@ +type = Type::T_ELSEIF; + } +} diff --git a/lib/scssphp/scssphp/src/Block/ForBlock.php b/lib/scssphp/scssphp/src/Block/ForBlock.php new file mode 100644 index 000000000..a9cf6733b --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/ForBlock.php @@ -0,0 +1,47 @@ +type = Type::T_FOR; + } +} diff --git a/lib/scssphp/scssphp/src/Block/IfBlock.php b/lib/scssphp/scssphp/src/Block/IfBlock.php new file mode 100644 index 000000000..9f21bf88a --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/IfBlock.php @@ -0,0 +1,37 @@ + + */ + public $cases = []; + + public function __construct() + { + $this->type = Type::T_IF; + } +} diff --git a/lib/scssphp/scssphp/src/Block/MediaBlock.php b/lib/scssphp/scssphp/src/Block/MediaBlock.php new file mode 100644 index 000000000..c49ee1b2b --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/MediaBlock.php @@ -0,0 +1,37 @@ +type = Type::T_MEDIA; + } +} diff --git a/lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php b/lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php new file mode 100644 index 000000000..1ea4a6c8a --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php @@ -0,0 +1,37 @@ +type = Type::T_NESTED_PROPERTY; + } +} diff --git a/lib/scssphp/scssphp/src/Block/WhileBlock.php b/lib/scssphp/scssphp/src/Block/WhileBlock.php new file mode 100644 index 000000000..ac18d4e02 --- /dev/null +++ b/lib/scssphp/scssphp/src/Block/WhileBlock.php @@ -0,0 +1,32 @@ +type = Type::T_WHILE; + } +} diff --git a/lib/scssphp/scssphp/src/CompilationResult.php b/lib/scssphp/scssphp/src/CompilationResult.php new file mode 100644 index 000000000..36adb0da4 --- /dev/null +++ b/lib/scssphp/scssphp/src/CompilationResult.php @@ -0,0 +1,69 @@ +css = $css; + $this->sourceMap = $sourceMap; + $this->includedFiles = $includedFiles; + } + + /** + * @return string + */ + public function getCss() + { + return $this->css; + } + + /** + * @return string[] + */ + public function getIncludedFiles() + { + return $this->includedFiles; + } + + /** + * The sourceMap content, if it was generated + * + * @return null|string + */ + public function getSourceMap() + { + return $this->sourceMap; + } +} diff --git a/lib/scssphp/scssphp/src/Compiler/CachedResult.php b/lib/scssphp/scssphp/src/Compiler/CachedResult.php new file mode 100644 index 000000000..a66291996 --- /dev/null +++ b/lib/scssphp/scssphp/src/Compiler/CachedResult.php @@ -0,0 +1,77 @@ + + */ + private $parsedFiles; + + /** + * @var array + * @phpstan-var list + */ + private $resolvedImports; + + /** + * @param CompilationResult $result + * @param array $parsedFiles + * @param array $resolvedImports + * + * @phpstan-param list $resolvedImports + */ + public function __construct(CompilationResult $result, array $parsedFiles, array $resolvedImports) + { + $this->result = $result; + $this->parsedFiles = $parsedFiles; + $this->resolvedImports = $resolvedImports; + } + + /** + * @return CompilationResult + */ + public function getResult() + { + return $this->result; + } + + /** + * @return array + */ + public function getParsedFiles() + { + return $this->parsedFiles; + } + + /** + * @return array + * + * @phpstan-return list + */ + public function getResolvedImports() + { + return $this->resolvedImports; + } +} diff --git a/lib/scssphp/scssphp/src/Exception/SassException.php b/lib/scssphp/scssphp/src/Exception/SassException.php new file mode 100644 index 000000000..9f62b3cd2 --- /dev/null +++ b/lib/scssphp/scssphp/src/Exception/SassException.php @@ -0,0 +1,7 @@ +stream = $stream; + $this->closeOnDestruct = $closeOnDestruct; + } + + /** + * @internal + */ + public function __destruct() + { + if ($this->closeOnDestruct) { + fclose($this->stream); + } + } + + /** + * @inheritDoc + */ + public function warn($message, $deprecation = false) + { + $prefix = ($deprecation ? 'DEPRECATION ' : '') . 'WARNING: '; + + fwrite($this->stream, $prefix . $message . "\n\n"); + } + + /** + * @inheritDoc + */ + public function debug($message) + { + fwrite($this->stream, $message . "\n"); + } +} diff --git a/lib/scssphp/scssphp/src/OutputStyle.php b/lib/scssphp/scssphp/src/OutputStyle.php new file mode 100644 index 000000000..c284639c1 --- /dev/null +++ b/lib/scssphp/scssphp/src/OutputStyle.php @@ -0,0 +1,9 @@ +parseValue($source, $value)) { + throw new \InvalidArgumentException(sprintf('Invalid value source "%s".', $source)); + } + + return $value; + } + + /** + * Converts a PHP value to a Sass value + * + * The returned value is guaranteed to be supported by the + * Compiler methods for registering custom variables. No other + * guarantee about it is provided. It should be considered + * opaque values by the caller. + * + * @param mixed $value + * + * @return mixed + */ + public static function fromPhp($value) + { + if ($value instanceof Number) { + return $value; + } + + if (is_array($value) && isset($value[0]) && \in_array($value[0], [Type::T_NULL, Type::T_COLOR, Type::T_KEYWORD, Type::T_LIST, Type::T_MAP, Type::T_STRING])) { + return $value; + } + + if ($value === null) { + return Compiler::$null; + } + + if ($value === true) { + return Compiler::$true; + } + + if ($value === false) { + return Compiler::$false; + } + + if ($value === '') { + return Compiler::$emptyString; + } + + if (\is_int($value) || \is_float($value)) { + return new Number($value, ''); + } + + if (\is_string($value)) { + return [Type::T_STRING, '"', [$value]]; + } + + throw new \InvalidArgumentException(sprintf('Cannot convert the value of type "%s" to a Sass value.', gettype($value))); + } +} diff --git a/lib/scssphp/scssphp/src/Warn.php b/lib/scssphp/scssphp/src/Warn.php new file mode 100644 index 000000000..592b44c70 --- /dev/null +++ b/lib/scssphp/scssphp/src/Warn.php @@ -0,0 +1,84 @@ +