mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°5108 - Update embedded libs for PHP 8.0 (3.0 branch)
This commit is contained in:
12
lib/scssphp/scssphp/phpcs.xml.dist
Normal file
12
lib/scssphp/scssphp/phpcs.xml.dist
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="PSR12 (adapted for PHP 5.6+)">
|
||||
<rule ref="PSR12">
|
||||
<!-- Ignore this PHP 7.1+ sniff as long as we support PHP 5.6+ -->
|
||||
<exclude name="PSR12.Properties.ConstantVisibility.NotFound"/>
|
||||
|
||||
<!-- This sniff doesn't ignore comment blocks -->
|
||||
<!--
|
||||
<exclude name="Generic.Files.LineLength"/>
|
||||
-->
|
||||
</rule>
|
||||
</ruleset>
|
||||
37
lib/scssphp/scssphp/src/Block/AtRootBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/AtRootBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class AtRootBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $selector;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $with;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_AT_ROOT;
|
||||
}
|
||||
}
|
||||
45
lib/scssphp/scssphp/src/Block/CallableBlock.php
Normal file
45
lib/scssphp/scssphp/src/Block/CallableBlock.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Compiler\Environment;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class CallableBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $args;
|
||||
|
||||
/**
|
||||
* @var Environment|null
|
||||
*/
|
||||
public $parentEnv;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
||||
38
lib/scssphp/scssphp/src/Block/ContentBlock.php
Normal file
38
lib/scssphp/scssphp/src/Block/ContentBlock.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Compiler\Environment;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ContentBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $child;
|
||||
|
||||
/**
|
||||
* @var Environment|null
|
||||
*/
|
||||
public $scope;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_INCLUDE;
|
||||
}
|
||||
}
|
||||
37
lib/scssphp/scssphp/src/Block/DirectiveBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/DirectiveBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class DirectiveBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var string|array
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string|array|null
|
||||
*/
|
||||
public $value;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_DIRECTIVE;
|
||||
}
|
||||
}
|
||||
37
lib/scssphp/scssphp/src/Block/EachBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/EachBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class EachBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $vars = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $list;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_EACH;
|
||||
}
|
||||
}
|
||||
27
lib/scssphp/scssphp/src/Block/ElseBlock.php
Normal file
27
lib/scssphp/scssphp/src/Block/ElseBlock.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ElseBlock extends Block
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_ELSE;
|
||||
}
|
||||
}
|
||||
32
lib/scssphp/scssphp/src/Block/ElseifBlock.php
Normal file
32
lib/scssphp/scssphp/src/Block/ElseifBlock.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ElseifBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $cond;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_ELSEIF;
|
||||
}
|
||||
}
|
||||
47
lib/scssphp/scssphp/src/Block/ForBlock.php
Normal file
47
lib/scssphp/scssphp/src/Block/ForBlock.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ForBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $var;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $start;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $end;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $until;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_FOR;
|
||||
}
|
||||
}
|
||||
37
lib/scssphp/scssphp/src/Block/IfBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/IfBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class IfBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $cond;
|
||||
|
||||
/**
|
||||
* @var array<ElseifBlock|ElseBlock>
|
||||
*/
|
||||
public $cases = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_IF;
|
||||
}
|
||||
}
|
||||
37
lib/scssphp/scssphp/src/Block/MediaBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/MediaBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class MediaBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var string|array|null
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
public $queryList;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_MEDIA;
|
||||
}
|
||||
}
|
||||
37
lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php
Normal file
37
lib/scssphp/scssphp/src/Block/NestedPropertyBlock.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class NestedPropertyBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $hasValue;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $prefix;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_NESTED_PROPERTY;
|
||||
}
|
||||
}
|
||||
32
lib/scssphp/scssphp/src/Block/WhileBlock.php
Normal file
32
lib/scssphp/scssphp/src/Block/WhileBlock.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Block;
|
||||
|
||||
use ScssPhp\ScssPhp\Block;
|
||||
use ScssPhp\ScssPhp\Type;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class WhileBlock extends Block
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $cond;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Type::T_WHILE;
|
||||
}
|
||||
}
|
||||
69
lib/scssphp/scssphp/src/CompilationResult.php
Normal file
69
lib/scssphp/scssphp/src/CompilationResult.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp;
|
||||
|
||||
class CompilationResult
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $css;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $sourceMap;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $includedFiles;
|
||||
|
||||
/**
|
||||
* @param string $css
|
||||
* @param string|null $sourceMap
|
||||
* @param string[] $includedFiles
|
||||
*/
|
||||
public function __construct($css, $sourceMap, array $includedFiles)
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
77
lib/scssphp/scssphp/src/Compiler/CachedResult.php
Normal file
77
lib/scssphp/scssphp/src/Compiler/CachedResult.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Compiler;
|
||||
|
||||
use ScssPhp\ScssPhp\CompilationResult;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class CachedResult
|
||||
{
|
||||
/**
|
||||
* @var CompilationResult
|
||||
*/
|
||||
private $result;
|
||||
|
||||
/**
|
||||
* @var array<string, int>
|
||||
*/
|
||||
private $parsedFiles;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @phpstan-var list<array{currentDir: string|null, path: string, filePath: string}>
|
||||
*/
|
||||
private $resolvedImports;
|
||||
|
||||
/**
|
||||
* @param CompilationResult $result
|
||||
* @param array<string, int> $parsedFiles
|
||||
* @param array $resolvedImports
|
||||
*
|
||||
* @phpstan-param list<array{currentDir: string|null, path: string, filePath: string}> $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<string, int>
|
||||
*/
|
||||
public function getParsedFiles()
|
||||
{
|
||||
return $this->parsedFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @phpstan-return list<array{currentDir: string|null, path: string, filePath: string}>
|
||||
*/
|
||||
public function getResolvedImports()
|
||||
{
|
||||
return $this->resolvedImports;
|
||||
}
|
||||
}
|
||||
7
lib/scssphp/scssphp/src/Exception/SassException.php
Normal file
7
lib/scssphp/scssphp/src/Exception/SassException.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace ScssPhp\ScssPhp\Exception;
|
||||
|
||||
interface SassException
|
||||
{
|
||||
}
|
||||
32
lib/scssphp/scssphp/src/Exception/SassScriptException.php
Normal file
32
lib/scssphp/scssphp/src/Exception/SassScriptException.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace ScssPhp\ScssPhp\Exception;
|
||||
|
||||
/**
|
||||
* An exception thrown by SassScript.
|
||||
*
|
||||
* This class does not implement SassException on purpose, as it should
|
||||
* never be returned to the outside code. The compilation will catch it
|
||||
* and replace it with a SassException reporting the location of the
|
||||
* error.
|
||||
*/
|
||||
class SassScriptException extends \Exception
|
||||
{
|
||||
/**
|
||||
* Creates a SassScriptException with support for an argument name.
|
||||
*
|
||||
* This helper ensures a consistent handling of argument names in the
|
||||
* error message, without duplicating it.
|
||||
*
|
||||
* @param string $message
|
||||
* @param string|null $name The argument name, without $
|
||||
*
|
||||
* @return SassScriptException
|
||||
*/
|
||||
public static function forArgument($message, $name = null)
|
||||
{
|
||||
$varDisplay = !\is_null($name) ? "\${$name}: " : '';
|
||||
|
||||
return new self($varDisplay . $message);
|
||||
}
|
||||
}
|
||||
48
lib/scssphp/scssphp/src/Logger/LoggerInterface.php
Normal file
48
lib/scssphp/scssphp/src/Logger/LoggerInterface.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Logger;
|
||||
|
||||
/**
|
||||
* Interface implemented by loggers for warnings and debug messages.
|
||||
*
|
||||
* The official Sass implementation recommends that loggers report the
|
||||
* messages immediately rather than waiting for the end of the
|
||||
* compilation, to provide a better debugging experience when the
|
||||
* compilation does not end (error or infinite loop after the warning
|
||||
* for instance).
|
||||
*/
|
||||
interface LoggerInterface
|
||||
{
|
||||
/**
|
||||
* Emits a warning with the given message.
|
||||
*
|
||||
* If $deprecation is true, it indicates that this is a deprecation
|
||||
* warning. Implementations should surface all this information to
|
||||
* the end user.
|
||||
*
|
||||
* @param string $message
|
||||
* @param bool $deprecation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function warn($message, $deprecation = false);
|
||||
|
||||
/**
|
||||
* Emits a debugging message.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function debug($message);
|
||||
}
|
||||
29
lib/scssphp/scssphp/src/Logger/QuietLogger.php
Normal file
29
lib/scssphp/scssphp/src/Logger/QuietLogger.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Logger;
|
||||
|
||||
/**
|
||||
* A logger that silently ignores all messages.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class QuietLogger implements LoggerInterface
|
||||
{
|
||||
public function warn($message, $deprecation = false)
|
||||
{
|
||||
}
|
||||
|
||||
public function debug($message)
|
||||
{
|
||||
}
|
||||
}
|
||||
62
lib/scssphp/scssphp/src/Logger/StreamLogger.php
Normal file
62
lib/scssphp/scssphp/src/Logger/StreamLogger.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp\Logger;
|
||||
|
||||
/**
|
||||
* A logger that prints to a PHP stream (for instance stderr)
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class StreamLogger implements LoggerInterface
|
||||
{
|
||||
private $stream;
|
||||
private $closeOnDestruct;
|
||||
|
||||
/**
|
||||
* @param resource $stream A stream resource
|
||||
* @param bool $closeOnDestruct If true, takes ownership of the stream and close it on destruct to avoid leaks.
|
||||
*/
|
||||
public function __construct($stream, $closeOnDestruct = false)
|
||||
{
|
||||
$this->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");
|
||||
}
|
||||
}
|
||||
9
lib/scssphp/scssphp/src/OutputStyle.php
Normal file
9
lib/scssphp/scssphp/src/OutputStyle.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace ScssPhp\ScssPhp;
|
||||
|
||||
final class OutputStyle
|
||||
{
|
||||
const EXPANDED = 'expanded';
|
||||
const COMPRESSED = 'compressed';
|
||||
}
|
||||
77
lib/scssphp/scssphp/src/Util/Path.php
Normal file
77
lib/scssphp/scssphp/src/Util/Path.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace ScssPhp\ScssPhp\Util;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class Path
|
||||
{
|
||||
/**
|
||||
* @param string $path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAbsolute($path)
|
||||
{
|
||||
if ($path === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($path[0] === '/') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (\DIRECTORY_SEPARATOR !== '\\') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($path[0] === '\\') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (\strlen($path) < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($path[1] !== ':') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($path[2] !== '/' && $path[2] !== '\\') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[A-Za-z]$/', $path[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $part1
|
||||
* @param string $part2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function join($part1, $part2)
|
||||
{
|
||||
if ($part1 === '' || self::isAbsolute($part2)) {
|
||||
return $part2;
|
||||
}
|
||||
|
||||
if ($part2 === '') {
|
||||
return $part1;
|
||||
}
|
||||
|
||||
$last = $part1[\strlen($part1) - 1];
|
||||
$separator = \DIRECTORY_SEPARATOR;
|
||||
|
||||
if ($last === '/' || $last === \DIRECTORY_SEPARATOR) {
|
||||
$separator = '';
|
||||
}
|
||||
|
||||
return $part1 . $separator . $part2;
|
||||
}
|
||||
}
|
||||
95
lib/scssphp/scssphp/src/ValueConverter.php
Normal file
95
lib/scssphp/scssphp/src/ValueConverter.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp;
|
||||
|
||||
use ScssPhp\ScssPhp\Node\Number;
|
||||
|
||||
final class ValueConverter
|
||||
{
|
||||
// Prevent instantiating it
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a value from a Scss source string.
|
||||
*
|
||||
* 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 string $source
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function parseValue($source)
|
||||
{
|
||||
$parser = new Parser(__CLASS__);
|
||||
|
||||
if (!$parser->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)));
|
||||
}
|
||||
}
|
||||
84
lib/scssphp/scssphp/src/Warn.php
Normal file
84
lib/scssphp/scssphp/src/Warn.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SCSSPHP
|
||||
*
|
||||
* @copyright 2012-2020 Leaf Corcoran
|
||||
*
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*
|
||||
* @link http://scssphp.github.io/scssphp
|
||||
*/
|
||||
|
||||
namespace ScssPhp\ScssPhp;
|
||||
|
||||
final class Warn
|
||||
{
|
||||
/**
|
||||
* @var callable|null
|
||||
* @phpstan-var (callable(string, bool): void)|null
|
||||
*/
|
||||
private static $callback;
|
||||
|
||||
/**
|
||||
* Prints a warning message associated with the current `@import` or function call.
|
||||
*
|
||||
* This may only be called within a custom function or importer callback.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function warning($message)
|
||||
{
|
||||
self::reportWarning($message, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a deprecation warning message associated with the current `@import` or function call.
|
||||
*
|
||||
* This may only be called within a custom function or importer callback.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function deprecation($message)
|
||||
{
|
||||
self::reportWarning($message, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable|null $callback
|
||||
*
|
||||
* @return callable|null The previous warn callback
|
||||
*
|
||||
* @phpstan-param (callable(string, bool): void)|null $callback
|
||||
*
|
||||
* @phpstan-return (callable(string, bool): void)|null
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function setCallback(callable $callback = null)
|
||||
{
|
||||
$previousCallback = self::$callback;
|
||||
self::$callback = $callback;
|
||||
|
||||
return $previousCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param bool $deprecation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function reportWarning($message, $deprecation)
|
||||
{
|
||||
if (self::$callback === null) {
|
||||
throw new \BadMethodCallException('The warning Reporter may only be called within a custom function or importer callback.');
|
||||
}
|
||||
|
||||
\call_user_func(self::$callback, $message, $deprecation);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user