Plugin Directory

Changeset 2820106


Ignore:
Timestamp:
11/17/2022 10:31:05 PM (3 years ago)
Author:
Sky Bolt
Message:

What's Changed

Update scssphp to version 1.10.0 by @fabarea in #228
Plugin upgrade to ScssPHP v1.10.0 by @shadoath in #233

New Contributors

@fabarea made their first contribution in #228

Location:
wp-scss/trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • wp-scss/trunk/readme.md

    r2616813 r2820106  
    3636- Crunched - Same as Compressed, but also removes multi-line comments.
    3737
    38 See examples of each in [scssphp's documentation](http://scssphp.github.io/scssphp)
     38See examples of each in [ScssPHP's documentation](http://scssphp.github.io/scssphp)
     39
     40- Current version of ScssPHP is 1.10.0
    3941
    4042#### Source Map Mode
     
    6062## Directions
    6163
    62 _This plugin requires at least php 5.6 to work._
     64_This plugin requires at least php 5.6 to work._ . Tested up to php 7.4
    6365
    6466#### Importing Subfiles
     
    111113## Changelog
    112114
     115- 3.0.0
     116  - Updates ScssPHP to version [1.10.0](https://github.com/scssphp/scssphp/releases/tag/v1.10.0) thanks to [fabarea](https://github.com/ConnectThink/WP-SCSS/issues/228)
    113117- 2.4.0
    114   - Changes the base_compiling_folder to store key not path to directory [shadoath](https://github.com/ConnectThink/WP-SCSS/issues/219)
     118  - Changes the base_compiling_folder to store key not path of directory [shadoath](https://github.com/ConnectThink/WP-SCSS/issues/219)
    115119  - This allows deploying from local or staging to production by not saving absolute paths in DB.
    116120- 2.3.5
  • wp-scss/trunk/readme.txt

    r2616813 r2820106  
    44Plugin URI: https://github.com/ConnectThink/WP-SCSS
    55Requires at least: 3.0.1
    6 Tested up to: 5.8
     6Tested up to: 6.0
    77Requires PHP: 5.6
    8 Stable tag: 2.4.0
     8Stable tag: 3.0.0
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/copyleft/gpl.html
     
    7676
    7777== Changelog ==
     78
     79= 3.0.0 =
     80  - Updates ScssPHP to version [1.10.0](https://github.com/scssphp/scssphp/releases/tag/v1.10.0) thanks to [fabarea](https://github.com/ConnectThink/WP-SCSS/issues/228)
     81
     82= 2.4.0 =
     83  - Changes the base_compiling_folder to store key not path to directory [shadoath](https://github.com/ConnectThink/WP-SCSS/issues/219)
     84  - This allows deploying from local or staging to production by not saving absolute paths in DB.
    7885
    7986= 2.3.5 =
  • wp-scss/trunk/scssphp/bin/pscss

    r2549034 r2820106  
    2727
    2828$style = null;
    29 $loadPaths = null;
     29$loadPaths = [];
    3030$dumpTree = false;
    3131$inputFile = null;
     
    3939 * Parse argument
    4040 *
    41  * @param integer $i
    42  * @param array $options
     41 * @param int      $i
     42 * @param string[] $options
    4343 *
    4444 * @return string|null
     
    149149
    150150    if (isset($value)) {
    151         $loadPaths = $value;
     151        $loadPaths[] = $value;
    152152        continue;
    153153    }
     
    189189
    190190if ($loadPaths) {
    191     $scss->setImportPaths(explode(PATH_SEPARATOR, $loadPaths));
     191    $scss->setImportPaths($loadPaths);
    192192}
    193193
  • wp-scss/trunk/scssphp/composer.json

    r2549034 r2820106  
    4141        "squizlabs/php_codesniffer": "~3.5",
    4242        "symfony/phpunit-bridge": "^5.1",
     43        "thoughtbot/bourbon": "^7.0",
    4344        "twbs/bootstrap": "~5.0",
    44         "twbs/bootstrap4": "4.6.0",
     45        "twbs/bootstrap4": "4.6.1",
    4546        "zurb/foundation": "~6.5"
    4647    },
     
    5051            "package": {
    5152                "name": "sass/sass-spec",
    52                 "version": "2021.05.10",
     53                "version": "2021.11.30",
    5354                "source": {
    5455                    "type": "git",
    5556                    "url": "https://github.com/sass/sass-spec.git",
    56                     "reference": "b9bf24a936528f333fb30ee59ca550c6da551c11"
     57                    "reference": "ee5b460ac84b1ce27b86e22c0252b4296444cf3a"
    5758                },
    5859                "dist": {
    5960                    "type": "zip",
    60                     "url": "https://api.github.com/repos/sass/sass-spec/zipball/b9bf24a936528f333fb30ee59ca550c6da551c11",
    61                     "reference": "b9bf24a936528f333fb30ee59ca550c6da551c11",
     61                    "url": "https://api.github.com/repos/sass/sass-spec/zipball/ee5b460ac84b1ce27b86e22c0252b4296444cf3a",
     62                    "reference": "ee5b460ac84b1ce27b86e22c0252b4296444cf3a",
     63                    "shasum": ""
     64                }
     65            }
     66        },
     67        {
     68            "type": "package",
     69            "package": {
     70                "name": "thoughtbot/bourbon",
     71                "version": "v7.0.0",
     72                "source": {
     73                    "type": "git",
     74                    "url": "https://github.com/thoughtbot/bourbon.git",
     75                    "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3"
     76                },
     77                "dist": {
     78                    "type": "zip",
     79                    "url": "https://api.github.com/repos/thoughtbot/bourbon/zipball/fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
     80                    "reference": "fbe338ee6807e7f7aa996d82c8a16f248bb149b3",
    6281                    "shasum": ""
    6382                }
     
    6887            "package": {
    6988                "name": "twbs/bootstrap4",
    70                 "version": "v4.6.0",
     89                "version": "v4.6.1",
    7190                "source": {
    7291                    "type": "git",
    7392                    "url": "https://github.com/twbs/bootstrap.git",
    74                     "reference": "6ffb0b48e455430f8a5359ed689ad64c1143fac2"
     93                    "reference": "043a03c95a2ad6738f85b65e53b9dbdfb03b8d10"
    7594                },
    7695                "dist": {
    7796                    "type": "zip",
    78                     "url": "https://api.github.com/repos/twbs/bootstrap/zipball/6ffb0b48e455430f8a5359ed689ad64c1143fac2",
    79                     "reference": "6ffb0b48e455430f8a5359ed689ad64c1143fac2",
     97                    "url": "https://api.github.com/repos/twbs/bootstrap/zipball/043a03c95a2ad6738f85b65e53b9dbdfb03b8d10",
     98                    "reference": "043a03c95a2ad6738f85b65e53b9dbdfb03b8d10",
    8099                    "shasum": ""
    81100                }
     
    85104    "bin": ["bin/pscss"],
    86105    "config": {
    87         "sort-packages": true
     106        "sort-packages": true,
     107        "allow-plugins": {
     108            "bamarni/composer-bin-plugin": true
     109        }
    88110    }
    89111}
  • wp-scss/trunk/scssphp/src/Base/Range.php

    r2549034 r2820106  
    3535     * Initialize range
    3636     *
    37      * @param integer|float $first
    38      * @param integer|float $last
     37     * @param int|float $first
     38     * @param int|float $last
    3939     */
    4040    public function __construct($first, $last)
     
    4747     * Test for inclusion in range
    4848     *
    49      * @param integer|float $value
     49     * @param int|float $value
    5050     *
    51      * @return boolean
     51     * @return bool
    5252     */
    5353    public function includes($value)
  • wp-scss/trunk/scssphp/src/Block.php

    r2549034 r2820106  
    2323{
    2424    /**
    25      * @var string
     25     * @var string|null
    2626     */
    2727    public $type;
    2828
    2929    /**
    30      * @var \ScssPhp\ScssPhp\Block
     30     * @var Block|null
    3131     */
    3232    public $parent;
     
    3838
    3939    /**
    40      * @var integer
     40     * @var int
    4141     */
    4242    public $sourceIndex;
    4343
    4444    /**
    45      * @var integer
     45     * @var int
    4646     */
    4747    public $sourceLine;
    4848
    4949    /**
    50      * @var integer
     50     * @var int
    5151     */
    5252    public $sourceColumn;
     
    6868
    6969    /**
    70      * @var \ScssPhp\ScssPhp\Block|null
     70     * @var Block|null
    7171     */
    7272    public $selfParent;
  • wp-scss/trunk/scssphp/src/Colors.php

    r2549034 r2820106  
    205205     * Reverse conversion : from RGBA to a color name if possible
    206206     *
    207      * @param integer $r
    208      * @param integer $g
    209      * @param integer $b
    210      * @param integer|float $a
     207     * @param int      $r
     208     * @param int      $g
     209     * @param int      $b
     210     * @param int|float $a
    211211     *
    212212     * @return string|null
  • wp-scss/trunk/scssphp/src/Compiler.php

    r2549034 r2820106  
    1414
    1515use ScssPhp\ScssPhp\Base\Range;
     16use ScssPhp\ScssPhp\Block\AtRootBlock;
     17use ScssPhp\ScssPhp\Block\CallableBlock;
     18use ScssPhp\ScssPhp\Block\DirectiveBlock;
     19use ScssPhp\ScssPhp\Block\EachBlock;
     20use ScssPhp\ScssPhp\Block\ElseBlock;
     21use ScssPhp\ScssPhp\Block\ElseifBlock;
     22use ScssPhp\ScssPhp\Block\ForBlock;
     23use ScssPhp\ScssPhp\Block\IfBlock;
     24use ScssPhp\ScssPhp\Block\MediaBlock;
     25use ScssPhp\ScssPhp\Block\NestedPropertyBlock;
     26use ScssPhp\ScssPhp\Block\WhileBlock;
    1627use ScssPhp\ScssPhp\Compiler\CachedResult;
    1728use ScssPhp\ScssPhp\Compiler\Environment;
     
    138149    public static $with         = [Type::T_KEYWORD, 'with'];
    139150    public static $without      = [Type::T_KEYWORD, 'without'];
     151    private static $emptyArgumentList = [Type::T_LIST, '', [], []];
    140152
    141153    /**
     
    195207
    196208    /**
     209     * @var bool
     210     */
     211    private $charset = true;
     212
     213    /**
    197214     * @var string|\ScssPhp\ScssPhp\Formatter
    198215     */
     
    222239    /**
    223240     * @var bool|null
     241     *
     242     * @deprecated
    224243     */
    225244    protected $charsetSeen;
     
    464483        $this->scope          = null;
    465484        $this->storeEnv       = null;
    466         $this->charsetSeen    = null;
    467485        $this->shouldEvaluate = null;
    468486        $this->ignoreCallStackMessage = false;
     
    517535            $prefix = '';
    518536
    519             if (!$this->charsetSeen) {
    520                 if (strlen($out) !== Util::mbStrlen($out)) {
    521                     $prefix = '@charset "UTF-8";' . "\n";
    522                     $out = $prefix . $out;
    523                 }
     537            if ($this->charset && strlen($out) !== Util::mbStrlen($out)) {
     538                $prefix = '@charset "UTF-8";' . "\n";
     539                $out = $prefix . $out;
    524540            }
    525541
     
    640656     * @param array $origin
    641657     *
    642      * @return boolean
     658     * @return bool
    643659     */
    644660    protected function isSelfExtend($target, $origin)
     
    849865     * Match extends
    850866     *
    851      * @param array   $selector
    852      * @param array   $out
    853      * @param integer $from
    854      * @param boolean $initial
     867     * @param array $selector
     868     * @param array $out
     869     * @param int  $from
     870     * @param bool  $initial
    855871     *
    856872     * @return void
     
    9851001     * @param array  $matches
    9861002     *
    987      * @return boolean
     1003     * @return bool
    9881004     */
    9891005    protected function isPseudoSelector($part, &$matches)
     
    10471063     * Match extends single
    10481064     *
    1049      * @param array   $rawSingle
    1050      * @param array   $outOrigin
    1051      * @param boolean $initial
    1052      *
    1053      * @return boolean
     1065     * @param array $rawSingle
     1066     * @param array $outOrigin
     1067     * @param bool  $initial
     1068     *
     1069     * @return bool
    10541070     */
    10551071    protected function matchExtendsSingle($rawSingle, &$outOrigin, $initial = true)
     
    12661282    protected function compileMedia(Block $media)
    12671283    {
     1284        assert($media instanceof MediaBlock);
    12681285        $this->pushEnv($media);
    12691286
     
    13431360     * Compile directive
    13441361     *
    1345      * @param \ScssPhp\ScssPhp\Block|array $directive
     1362     * @param DirectiveBlock|array                  $directive
    13461363     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
    13471364     *
     
    14091426    protected function compileAtRoot(Block $block)
    14101427    {
     1428        assert($block instanceof AtRootBlock);
    14111429        $env     = $this->pushEnv($block);
    14121430        $envs    = $this->compactEnv($env);
     
    14571475
    14581476    /**
    1459      * Filter at-root scope depending of with/without option
     1477     * Filter at-root scope depending on with/without option
    14601478     *
    14611479     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
     
    15571575     *
    15581576     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
    1559      * @param integer                                $depth
     1577     * @param int                                    $depth
    15601578     *
    15611579     * @return array
     
    15811599     * Compile @at-root's with: inclusion / without: exclusion into 2 lists uses to filter scope/env later
    15821600     *
    1583      * @param array $withCondition
     1601     * @param array|null $withCondition
    15841602     *
    15851603     * @return array
     1604     *
     1605     * @phpstan-return array{array<string, bool>, array<string, bool>}
    15861606     */
    15871607    protected function compileWith($withCondition)
     
    16031623            }
    16041624
    1605             if ($this->mapHasKey($withCondition, static::$with)) {
     1625            $withConfig = $this->mapGet($withCondition, static::$with);
     1626            if ($withConfig !== null) {
    16061627                $without = []; // cancel the default
    1607                 $list = $this->coerceList($this->libMapGet([$withCondition, static::$with]));
     1628                $list = $this->coerceList($withConfig);
    16081629
    16091630                foreach ($list[2] as $item) {
     
    16141635            }
    16151636
    1616             if ($this->mapHasKey($withCondition, static::$without)) {
     1637            $withoutConfig = $this->mapGet($withCondition, static::$without);
     1638            if ($withoutConfig !== null) {
    16171639                $without = []; // cancel the default
    1618                 $list = $this->coerceList($this->libMapGet([$withCondition, static::$without]));
     1640                $list = $this->coerceList($withoutConfig);
    16191641
    16201642                foreach ($list[2] as $item) {
     
    16661688     * @param array                                                         $without
    16671689     *
    1668      * @return boolean
     1690     * @return bool
    16691691     */
    16701692    protected function isWith($block, $with, $without)
     
    16761698
    16771699            if ($block->type === Type::T_DIRECTIVE) {
     1700                assert($block instanceof DirectiveBlock || $block instanceof OutputBlock);
    16781701                if (isset($block->name)) {
    16791702                    return $this->testWithWithout($this->compileDirectiveName($block->name), $with, $without);
     
    17111734     * @param array  $without
    17121735     *
    1713      * @return boolean
     1736     * @return bool
    17141737     *   true if the block should be kept, false to reject
    17151738     */
     
    17661789    protected function compileNestedPropertiesBlock(Block $block, OutputBlock $out)
    17671790    {
     1791        assert($block instanceof NestedPropertyBlock);
    17681792        $prefix = $this->compileValue($block->prefix) . '-';
    17691793
     
    17841808
    17851809                case Type::T_NESTED_PROPERTY:
     1810                    assert($child[1] instanceof NestedPropertyBlock);
    17861811                    array_unshift($child[1]->prefix[2], $prefix);
    17871812                    break;
     
    18091834        // wrap assign children in a block
    18101835        // except for @font-face
    1811         if ($block->type !== Type::T_DIRECTIVE || $this->compileDirectiveName($block->name) !== 'font-face') {
     1836        if (!$block instanceof DirectiveBlock || $this->compileDirectiveName($block->name) !== 'font-face') {
    18121837            // need wrapping?
    18131838            $needWrapping = false;
     
    18981923     * Compile the value of a comment that can have interpolation
    18991924     *
    1900      * @param array   $value
    1901      * @param boolean $pushEnv
     1925     * @param array $value
     1926     * @param bool  $pushEnv
    19021927     *
    19031928     * @return string
     
    22162241     * @param array $selector
    22172242     *
    2218      * @return boolean
     2243     * @return bool
    22192244     */
    22202245    protected function hasSelectorPlaceholder($selector)
     
    26332658     * @param array                                  $rawPath
    26342659     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
    2635      * @param boolean                                $once
    2636      *
    2637      * @return boolean
     2660     * @param bool                                   $once
     2661     *
     2662     * @return bool
    26382663     */
    26392664    protected function compileImport($rawPath, OutputBlock $out, $once = false)
     
    27702795        $child = $this->makeOutputBlock(Type::T_COMMENT);
    27712796        $child->lines[]      = $line;
    2772         $child->sourceName   = $this->sourceNames[$this->sourceIndex];
     2797        $child->sourceName   = $this->sourceNames[$this->sourceIndex] ?: '(stdin)';
    27732798        $child->sourceLine   = $this->sourceLine;
    27742799        $child->sourceColumn = $this->sourceColumn;
     
    28782903
    28792904            case Type::T_CHARSET:
    2880                 if (! $this->charsetSeen) {
    2881                     $this->charsetSeen = true;
    2882                     $this->appendRootDirective('@charset ' . $this->compileValue($child[1]) . ';', $out);
    2883                 }
    28842905                break;
    28852906
     
    30453066            case Type::T_FUNCTION:
    30463067                list(, $block) = $child;
     3068                assert($block instanceof CallableBlock);
    30473069                // the block need to be able to go up to it's parent env to resolve vars
    30483070                $block->parentEnv = $this->getStoreEnv();
     
    30733095                        }
    30743096
     3097                        if (\count($result) > 1) {
     3098                            $replacement = implode(', ', $result);
     3099                            $fname = $this->getPrettyPath($this->sourceNames[$this->sourceIndex]);
     3100                            $line = $this->sourceLine;
     3101
     3102                            $message = <<<EOL
     3103on line $line of $fname:
     3104Compound selectors may no longer be extended.
     3105Consider `@extend $replacement` instead.
     3106See http://bit.ly/ExtendCompound for details.
     3107EOL;
     3108
     3109                            $this->logger->warn($message);
     3110                        }
     3111
    30753112                        $this->pushExtends($result, $selectors, $child);
    30763113                    }
     
    30803117            case Type::T_IF:
    30813118                list(, $if) = $child;
     3119                assert($if instanceof IfBlock);
    30823120
    30833121                if ($this->isTruthy($this->reduce($if->cond, true))) {
     
    30873125                foreach ($if->cases as $case) {
    30883126                    if (
    3089                         $case->type === Type::T_ELSE ||
    3090                         $case->type === Type::T_ELSEIF && $this->isTruthy($this->reduce($case->cond))
     3127                        $case instanceof ElseBlock ||
     3128                        $case instanceof ElseifBlock && $this->isTruthy($this->reduce($case->cond))
    30913129                    ) {
    30923130                        return $this->compileChildren($case->children, $out);
     
    30973135            case Type::T_EACH:
    30983136                list(, $each) = $child;
     3137                assert($each instanceof EachBlock);
    30993138
    31003139                $list = $this->coerceList($this->reduce($each->list), ',', true);
     
    31313170            case Type::T_WHILE:
    31323171                list(, $while) = $child;
     3172                assert($while instanceof WhileBlock);
    31333173
    31343174                while ($this->isTruthy($this->reduce($while->cond, true))) {
     
    31433183            case Type::T_FOR:
    31443184                list(, $for) = $child;
     3185                assert($for instanceof ForBlock);
    31453186
    31463187                $startNumber = $this->assertNumber($this->reduce($for->start, true));
     
    32033244                }
    32043245
     3246                assert($mixin instanceof CallableBlock);
     3247
    32053248                $callingScope = $this->getStoreEnv();
    32063249
     
    33753418     * @param array|Number $value
    33763419     *
    3377      * @return boolean
     3420     * @return bool
    33783421     */
    33793422    public function isTruthy($value)
     
    33873430     * @param string $value
    33883431     *
    3389      * @return boolean
     3432     * @return bool
    33903433     */
    33913434    protected function isImmediateRelationshipCombinator($value)
     
    33993442     * @param array $value
    34003443     *
    3401      * @return boolean
     3444     * @return bool
    34023445     */
    34033446    protected function shouldEval($value)
     
    34223465     *
    34233466     * @param array|Number $value
    3424      * @param boolean $inExp
     3467     * @param bool        $inExp
    34253468     *
    34263469     * @return array|Number
     
    38133856        // try to find a native lib function
    38143857        $normalizedName = $this->normalizeName($name);
    3815         $libName = null;
    38163858
    38173859        if (isset($this->userFunctions[$normalizedName])) {
     
    38223864        }
    38233865
     3866        $lowercasedName = strtolower($normalizedName);
     3867
     3868        // Special functions overriding a CSS function are case-insensitive. We normalize them as lowercase
     3869        // to avoid the deprecation warning about the wrong case being used.
     3870        if ($lowercasedName === 'min' || $lowercasedName === 'max') {
     3871            $normalizedName = $lowercasedName;
     3872        }
     3873
    38243874        if (($f = $this->getBuiltinFunction($normalizedName)) && \is_callable($f)) {
    38253875            $libName   = $f[1];
    38263876            $prototype = isset(static::$$libName) ? static::$$libName : null;
     3877
     3878            // All core functions have a prototype defined. Not finding the
     3879            // prototype can mean 2 things:
     3880            // - the function comes from a child class (deprecated just after)
     3881            // - the function was found with a different case, which relates to calling the
     3882            //   wrong Sass function due to our camelCase usage (`fade-in()` vs `fadein()`),
     3883            //   because PHP method names are case-insensitive while property names are
     3884            //   case-sensitive.
     3885            if ($prototype === null || strtolower($normalizedName) !== $normalizedName) {
     3886                $r = new \ReflectionMethod($this, $libName);
     3887                $actualLibName = $r->name;
     3888
     3889                if ($actualLibName !== $libName || strtolower($normalizedName) !== $normalizedName) {
     3890                    $kebabCaseName = preg_replace('~(?<=\\w)([A-Z])~', '-$1', substr($actualLibName, 3));
     3891                    assert($kebabCaseName !== null);
     3892                    $originalName = strtolower($kebabCaseName);
     3893                    $warning = "Calling built-in functions with a non-standard name is deprecated since Scssphp 1.8.0 and will not work anymore in 2.0 (they will be treated as CSS function calls instead).\nUse \"$originalName\" instead of \"$name\".";
     3894                    @trigger_error($warning, E_USER_DEPRECATED);
     3895                    $fname = $this->getPrettyPath($this->sourceNames[$this->sourceIndex]);
     3896                    $line  = $this->sourceLine;
     3897                    Warn::deprecation("$warning\n         on line $line of $fname");
     3898
     3899                    // Use the actual function definition
     3900                    $prototype = isset(static::$$actualLibName) ? static::$$actualLibName : null;
     3901                    $f[1] = $libName = $actualLibName;
     3902                }
     3903            }
    38273904
    38283905            if (\get_class($this) !== __CLASS__ && !isset($this->warnedChildFunctions[$libName])) {
     
    38933970                }
    38943971
     3972                if ($value[1] === '' && count($value[2]) > 1) {
     3973                    $value[1] = ' ';
     3974                }
     3975
    38953976                return $value;
    38963977
     
    40084089     *
    40094090     * @param array|Number $left
    4010      * @param array|Number  $right
    4011      * @param boolean $shouldEval
     4091     * @param array|Number $right
     4092     * @param bool        $shouldEval
    40124093     *
    40134094     * @return array|Number|null
     
    40374118     * @param array|Number $left
    40384119     * @param array|Number $right
    4039      * @param boolean $shouldEval
     4120     * @param bool        $shouldEval
    40404121     *
    40414122     * @return array|Number|null
     
    44634544                    if (
    44644545                        $value[1] === "'" &&
    4465                         (strpos($content, '"') === false or strpos($content, "'") !== false) &&
    4466                         strpbrk($content, '{}\\\'') !== false
     4546                        (strpos($content, '"') === false or strpos($content, "'") !== false)
    44674547                    ) {
    44684548                        $value[1] = '"';
     
    45164596                    }
    45174597                }
     4598
     4599                $separator = $delim === '/' ? ' /' : $delim;
    45184600
    45194601                $prefix_value = '';
     
    45554637                }
    45564638
    4557                 return $pre . substr(implode("$delim", $filtered), \strlen($prefix_value)) . $post;
     4639                return $pre . substr(implode($separator, $filtered), \strlen($prefix_value)) . $post;
    45584640
    45594641            case Type::T_MAP:
     
    48274909     * Join selectors; looks for & to replace, or append parent before child
    48284910     *
    4829      * @param array   $parent
    4830      * @param array   $child
    4831      * @param boolean $stillHasSelf
    4832      * @param array   $selfParentSelectors
     4911     * @param array $parent
     4912     * @param array $child
     4913     * @param bool  $stillHasSelf
     4914     * @param array $selfParentSelectors
    48334915
    48344916     * @return array
     
    49074989            return $this->multiplyMedia($env->parent, $childQueries);
    49084990        }
     4991
     4992        assert($env->block instanceof MediaBlock);
    49094993
    49104994        $parentQueries = isset($env->block->queryList)
     
    50425126     * @param string                                $name
    50435127     * @param mixed                                 $value
    5044      * @param boolean                               $shadow
     5128     * @param bool                                  $shadow
    50455129     * @param \ScssPhp\ScssPhp\Compiler\Environment $env
    50465130     * @param mixed                                 $valueUnreduced
     
    51485232     *
    51495233     * @param string                                $name
    5150      * @param boolean                               $shouldThrow
     5234     * @param bool                                  $shouldThrow
    51515235     * @param \ScssPhp\ScssPhp\Compiler\Environment $env
    5152      * @param boolean                               $unreduced
     5236     * @param bool                                  $unreduced
    51535237     *
    51545238     * @return mixed|null
     
    52175301     * @param \ScssPhp\ScssPhp\Compiler\Environment $env
    52185302     *
    5219      * @return boolean
     5303     * @return bool
    52205304     */
    52215305    protected function has($name, Environment $env = null)
     
    54075491     * @api
    54085492     *
    5409      * @param integer $numberPrecision
     5493     * @param int $numberPrecision
    54105494     *
    54115495     * @return void
     
    54855569
    54865570    /**
     5571     * Configures the handling of non-ASCII outputs.
     5572     *
     5573     * If $charset is `true`, this will include a `@charset` declaration or a
     5574     * UTF-8 [byte-order mark][] if the stylesheet contains any non-ASCII
     5575     * characters. Otherwise, it will never include a `@charset` declaration or a
     5576     * byte-order mark.
     5577     *
     5578     * [byte-order mark]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
     5579     *
     5580     * @param bool $charset
     5581     *
     5582     * @return void
     5583     */
     5584    public function setCharset($charset)
     5585    {
     5586        $this->charset = $charset;
     5587    }
     5588
     5589    /**
    54875590     * Enable/disable source maps
    54885591     *
    54895592     * @api
    54905593     *
    5491      * @param integer $sourceMap
     5594     * @param int $sourceMap
    54925595     *
    54935596     * @return void
     
    58585961
    58595962        if (0 === strpos($normalizedPath, $normalizedRootDirectory)) {
    5860             return substr($normalizedPath, \strlen($normalizedRootDirectory));
     5963            return substr($path, \strlen($normalizedRootDirectory));
    58615964        }
    58625965
     
    58915994     * @api
    58925995     *
    5893      * @param boolean $ignoreErrors
     5996     * @param bool $ignoreErrors
    58945997     *
    58955998     * @return \ScssPhp\ScssPhp\Compiler
     
    60306133     * Beautify call stack for output
    60316134     *
    6032      * @param boolean  $all
     6135     * @param bool     $all
    60336136     * @param int|null $limit
    60346137     *
     
    60906193     * Call SCSS @function
    60916194     *
    6092      * @param Object $func
    6093      * @param array  $argValues
     6195     * @param CallableBlock|null $func
     6196     * @param array              $argValues
    60946197     *
    60956198     * @return array|Number
     
    66656768     * @param array[]    $argDef
    66666769     * @param array|null $argValues
    6667      * @param boolean $storeInEnv
    6668      * @param boolean $reduce
    6669      *   only used if $storeInEnv = false
     6770     * @param bool       $storeInEnv
     6771     * @param bool       $reduce     only used if $storeInEnv = false
    66706772     *
    66716773     * @return array<string, array|Number>
     
    68626964
    68636965    /**
    6864      * Coerce something to map
    6865      *
    6866      * @param array|Number $item
    6867      *
    6868      * @return array|Number
    6869      */
    6870     protected function coerceMap($item)
    6871     {
     6966     * Tries to convert an item to a Sass map
     6967     *
     6968     * @param Number|array $item
     6969     *
     6970     * @return array|null
     6971     */
     6972    private function tryMap($item)
     6973    {
     6974        if ($item instanceof Number) {
     6975            return null;
     6976        }
     6977
    68726978        if ($item[0] === Type::T_MAP) {
    68736979            return $item;
     
    68816987        }
    68826988
     6989        return null;
     6990    }
     6991
     6992    /**
     6993     * Coerce something to map
     6994     *
     6995     * @param array|Number $item
     6996     *
     6997     * @return array|Number
     6998     */
     6999    protected function coerceMap($item)
     7000    {
     7001        $map = $this->tryMap($item);
     7002
     7003        if ($map !== null) {
     7004            return $map;
     7005        }
     7006
    68837007        return $item;
    68847008    }
     
    68897013     * @param array|Number $item
    68907014     * @param string       $delim
    6891      * @param boolean      $removeTrailingNull
     7015     * @param bool         $removeTrailingNull
    68927016     *
    68937017     * @return array
     
    68967020    {
    68977021        if ($item instanceof Number) {
    6898             return [Type::T_LIST, $delim, [$item]];
     7022            return [Type::T_LIST, '', [$item]];
    68997023        }
    69007024
     
    69177041                $value = $values[$i];
    69187042
    6919                 switch ($key[0]) {
    6920                     case Type::T_LIST:
    6921                     case Type::T_MAP:
    6922                     case Type::T_STRING:
    6923                     case Type::T_NULL:
    6924                         break;
    6925 
    6926                     default:
    6927                         $key = [Type::T_KEYWORD, $this->compileStringContent($this->coerceString($key))];
    6928                         break;
    6929                 }
    6930 
    69317043                $list[] = [
    69327044                    Type::T_LIST,
    6933                     '',
     7045                    ' ',
    69347046                    [$key, $value]
    69357047                ];
    69367048            }
    69377049
    6938             return [Type::T_LIST, ',', $list];
    6939         }
    6940 
    6941         return [Type::T_LIST, $delim, [$item]];
     7050            return [Type::T_LIST, $list ? ',' : '', $list];
     7051        }
     7052
     7053        return [Type::T_LIST, '', [$item]];
    69427054    }
    69437055
     
    70807192
    70817193    /**
    7082      * @param integer|Number $value
    7083      * @param boolean        $isAlpha
    7084      *
    7085      * @return integer|mixed
     7194     * @param int|Number $value
     7195     * @param bool       $isAlpha
     7196     *
     7197     * @return int|mixed
    70867198     */
    70877199    protected function compileRGBAValue($value, $isAlpha = false)
     
    70957207
    70967208    /**
    7097      * @param mixed         $value
    7098      * @param integer|float $min
    7099      * @param integer|float $max
    7100      * @param boolean       $isInt
    7101      *
    7102      * @return integer|mixed
     7209     * @param mixed     $value
     7210     * @param int|float $min
     7211     * @param int|float $max
     7212     * @param bool      $isInt
     7213     *
     7214     * @return int|mixed
    71037215     */
    71047216    protected function compileColorPartValue($value, $min, $max, $isInt = true)
     
    71947306     * @param array|Number $value
    71957307     *
    7196      * @return integer|float
     7308     * @return int|float
     7309     *
     7310     * @deprecated
    71977311     */
    71987312    protected function coercePercent($value)
    71997313    {
     7314        @trigger_error(sprintf('"%s" is deprecated since 1.7.0.', __METHOD__), E_USER_DEPRECATED);
     7315
    72007316        if ($value instanceof Number) {
    72017317            if ($value->hasUnit('%')) {
     
    72237339    public function assertMap($value, $varName = null)
    72247340    {
    7225         $value = $this->coerceMap($value);
    7226 
    7227         if ($value[0] !== Type::T_MAP) {
     7341        $map = $this->tryMap($value);
     7342
     7343        if ($map === null) {
    72287344            $value = $this->compileValue($value);
    72297345
     
    72317347        }
    72327348
    7233         return $value;
     7349        return $map;
    72347350    }
    72357351
     
    73287444     * @param string|null  $varName
    73297445     *
    7330      * @return integer
     7446     * @return int
    73317447     *
    73327448     * @throws SassScriptException
     
    73927508     * @internal
    73937509     *
    7394      * @param integer $red
    7395      * @param integer $green
    7396      * @param integer $blue
     7510     * @param int $red
     7511     * @param int $green
     7512     * @param int $blue
    73977513     *
    73987514     * @return array
     
    74247540        }
    74257541
    7426         return [Type::T_HSL, fmod($h, 360), $s * 100, $l / 5.1];
     7542        return [Type::T_HSL, fmod($h + 360, 360), $s * 100, $l / 5.1];
    74277543    }
    74287544
     
    74987614     * @api
    74997615     *
    7500      * @param integer $hue        H from 0 to 360
    7501      * @param integer $whiteness  W from 0 to 100
    7502      * @param integer $blackness  B from 0 to 100
     7616     * @param int $hue        H from 0 to 360
     7617     * @param int $whiteness  W from 0 to 100
     7618     * @param int $blackness  B from 0 to 100
    75037619     *
    75047620     * @return array
     
    75307646     * @api
    75317647     *
    7532      * @param integer $red
    7533      * @param integer $green
    7534      * @param integer $blue
     7648     * @param int $red
     7649     * @param int $green
     7650     * @param int $blue
    75357651     *
    75367652     * @return array
     
    76607776        $values = [];
    76617777
    7662 
    76637778        foreach ($list[2] as $item) {
    76647779            $values[] = $this->normalizeValue($item);
     
    77057820                    }
    77067821                } else {
    7707                     $color = [Type::T_STRING, '', [$funcName . '(', $args[0], ')']];
     7822                    $color = [Type::T_STRING, '', [$funcName . '(', $args[0], ', ', $args[1], ')']];
    77087823                }
    77097824                break;
     
    80068121    // mix two colors
    80078122    protected static $libMix = [
    8008         ['color1', 'color2', 'weight:0.5'],
    8009         ['color-1', 'color-2', 'weight:0.5']
     8123        ['color1', 'color2', 'weight:50%'],
     8124        ['color-1', 'color-2', 'weight:50%']
    80108125        ];
    80118126    protected function libMix($args)
     
    80158130        $first = $this->assertColor($first, 'color1');
    80168131        $second = $this->assertColor($second, 'color2');
    8017         $weight = $this->coercePercent($this->assertNumber($weight, 'weight'));
     8132        $weightScale = $this->assertNumber($weight, 'weight')->valueInRange(0, 100, 'weight') / 100;
    80188133
    80198134        $firstAlpha = isset($first[4]) ? $first[4] : 1;
    80208135        $secondAlpha = isset($second[4]) ? $second[4] : 1;
    80218136
    8022         $w = $weight * 2 - 1;
    8023         $a = $firstAlpha - $secondAlpha;
    8024 
    8025         $w1 = (($w * $a === -1 ? $w : ($w + $a) / (1 + $w * $a)) + 1) / 2.0;
    8026         $w2 = 1.0 - $w1;
     8137        $normalizedWeight = $weightScale * 2 - 1;
     8138        $alphaDistance = $firstAlpha - $secondAlpha;
     8139
     8140        $combinedWeight = $normalizedWeight * $alphaDistance == -1 ? $normalizedWeight : ($normalizedWeight + $alphaDistance) / (1 + $normalizedWeight * $alphaDistance);
     8141        $weight1 = ($combinedWeight + 1) / 2.0;
     8142        $weight2 = 1.0 - $weight1;
    80278143
    80288144        $new = [Type::T_COLOR,
    8029             $w1 * $first[1] + $w2 * $second[1],
    8030             $w1 * $first[2] + $w2 * $second[2],
    8031             $w1 * $first[3] + $w2 * $second[3],
     8145            $weight1 * $first[1] + $weight2 * $second[1],
     8146            $weight1 * $first[2] + $weight2 * $second[2],
     8147            $weight1 * $first[3] + $weight2 * $second[3],
    80328148        ];
    80338149
    80348150        if ($firstAlpha != 1.0 || $secondAlpha != 1.0) {
    8035             $new[] = $firstAlpha * $weight + $secondAlpha * (1 - $weight);
     8151            $new[] = $firstAlpha * $weightScale + $secondAlpha * (1 - $weightScale);
    80368152        }
    80378153
     
    81108226        }
    81118227
    8112         $hueValue = $hue->getDimension() % 360;
     8228        $hueValue = fmod($hue->getDimension(), 360);
    81138229
    81148230        while ($hueValue < 0) {
     
    82888404    */
    82898405
     8406    /**
     8407     * @param array     $color
     8408     * @param int       $idx
     8409     * @param int|float $amount
     8410     *
     8411     * @return array
     8412     */
    82908413    protected function adjustHsl($color, $idx, $amount)
    82918414    {
    82928415        $hsl = $this->toHSL($color[1], $color[2], $color[3]);
    82938416        $hsl[$idx] += $amount;
     8417
     8418        if ($idx !== 1) {
     8419            // Clamp the saturation and lightness
     8420            $hsl[$idx] = min(max(0, $hsl[$idx]), 100);
     8421        }
     8422
    82948423        $out = $this->toRGB($hsl[1], $hsl[2], $hsl[3]);
    82958424
     
    83398468        }
    83408469
    8341         $color = $this->assertColor($value, 'color');
    8342         $amount = 100 * $this->coercePercent($this->assertNumber($args[1], 'amount'));
    8343 
    8344         return $this->adjustHsl($color, 2, $amount);
     8470        $color = $this->assertColor($args[0], 'color');
     8471        $amount = $this->assertNumber($args[1], 'amount');
     8472
     8473        return $this->adjustHsl($color, 2, $amount->valueInRange(0, 100, 'amount'));
    83458474    }
    83468475
     
    83498478    {
    83508479        $color = $this->assertColor($args[0], 'color');
    8351         $amount = 100 * $this->coercePercent($this->assertNumber($args[1], 'amount'));
    8352 
    8353         return $this->adjustHsl($color, 2, -$amount);
     8480        $amount = $this->assertNumber($args[1], 'amount');
     8481
     8482        return $this->adjustHsl($color, 2, -$amount->valueInRange(0, 100, 'amount'));
    83548483    }
    83558484
     
    83728501    }
    83738502
    8374     protected static $libInvert = ['color', 'weight:1'];
     8503    protected static $libInvert = ['color', 'weight:100%'];
    83758504    protected function libInvert($args)
    83768505    {
    83778506        $value = $args[0];
    83788507
     8508        $weight = $this->assertNumber($args[1], 'weight');
     8509
    83798510        if ($value instanceof Number) {
     8511            if ($weight->getDimension() != 100 || !$weight->hasUnit('%')) {
     8512                throw new SassScriptException('Only one argument may be passed to the plain-CSS invert() function.');
     8513            }
     8514
    83808515            return null;
    83818516        }
    8382 
    8383         $weight = $this->coercePercent($this->assertNumber($args[1], 'weight'));
    83848517
    83858518        $color = $this->assertColor($value, 'color');
     
    83898522        $inverted[3] = 255 - $inverted[3];
    83908523
    8391         if ($weight < 1) {
    8392             return $this->libMix([$inverted, $color, new Number($weight, '')]);
    8393         }
    8394 
    8395         return $inverted;
     8524        return $this->libMix([$inverted, $color, $weight]);
    83968525    }
    83978526
     
    84018530    {
    84028531        $color = $this->assertColor($args[0], 'color');
    8403         $amount = $this->coercePercent($this->assertNumber($args[1], 'amount'));
    8404 
    8405         $color[4] = (isset($color[4]) ? $color[4] : 1) + $amount;
     8532        $amount = $this->assertNumber($args[1], 'amount');
     8533
     8534        $color[4] = (isset($color[4]) ? $color[4] : 1) + $amount->valueInRange(0, 1, 'amount');
    84068535        $color[4] = min(1, max(0, $color[4]));
    84078536
     
    84208549    {
    84218550        $color = $this->assertColor($args[0], 'color');
    8422         $amount = $this->coercePercent($this->assertNumber($args[1], 'amount'));
    8423 
    8424         $color[4] = (isset($color[4]) ? $color[4] : 1) - $amount;
     8551        $amount = $this->assertNumber($args[1], 'amount');
     8552
     8553        $color[4] = (isset($color[4]) ? $color[4] : 1) - $amount->valueInRange(0, 1, 'amount');
    84258554        $color[4] = min(1, max(0, $color[4]));
    84268555
     
    85718700        $list = $this->coerceList($args[0]);
    85728701
    8573         if (\count($list[2]) <= 1 && empty($list['enclosing'])) {
     8702        if ($list[1] === '' && \count($list[2]) <= 1 && empty($list['enclosing'])) {
    85748703            return [Type::T_KEYWORD, 'space'];
    85758704        }
     
    85778706        if ($list[1] === ',') {
    85788707            return [Type::T_KEYWORD, 'comma'];
     8708        }
     8709
     8710        if ($list[1] === '/') {
     8711            return [Type::T_KEYWORD, 'slash'];
    85798712        }
    85808713
     
    86188751    }
    86198752
    8620     protected static $libMapGet = ['map', 'key'];
     8753    protected static $libMapGet = ['map', 'key', 'keys...'];
    86218754    protected function libMapGet($args)
    86228755    {
    86238756        $map = $this->assertMap($args[0], 'map');
    8624         $key = $args[1];
    8625 
    8626         if (! \is_null($key)) {
    8627             $key = $this->compileStringContent($this->coerceString($key));
    8628 
    8629             for ($i = \count($map[1]) - 1; $i >= 0; $i--) {
    8630                 if ($key === $this->compileStringContent($this->coerceString($map[1][$i]))) {
    8631                     return $map[2][$i];
    8632                 }
    8633             }
    8634         }
    8635 
    8636         return static::$null;
     8757        if (!isset($args[2])) {
     8758            // BC layer for usages of the function from PHP code rather than from the Sass function
     8759            $args[2] = self::$emptyArgumentList;
     8760        }
     8761        $keys = array_merge([$args[1]], $args[2][2]);
     8762        $value = static::$null;
     8763
     8764        foreach ($keys as $key) {
     8765            if (!\is_array($map) || $map[0] !== Type::T_MAP) {
     8766                return static::$null;
     8767            }
     8768
     8769            $map = $this->mapGet($map, $key);
     8770
     8771            if ($map === null) {
     8772                return static::$null;
     8773            }
     8774
     8775            $value = $map;
     8776        }
     8777
     8778        return $value;
     8779    }
     8780
     8781    /**
     8782     * Gets the value corresponding to that key in the map
     8783     *
     8784     * @param array        $map
     8785     * @param Number|array $key
     8786     *
     8787     * @return Number|array|null
     8788     */
     8789    private function mapGet(array $map, $key)
     8790    {
     8791        $index = $this->mapGetEntryIndex($map, $key);
     8792
     8793        if ($index !== null) {
     8794            return $map[2][$index];
     8795        }
     8796
     8797        return null;
     8798    }
     8799
     8800    /**
     8801     * Gets the index corresponding to that key in the map entries
     8802     *
     8803     * @param array        $map
     8804     * @param Number|array $key
     8805     *
     8806     * @return int|null
     8807     */
     8808    private function mapGetEntryIndex(array $map, $key)
     8809    {
     8810        $key = $this->compileStringContent($this->coerceString($key));
     8811
     8812        for ($i = \count($map[1]) - 1; $i >= 0; $i--) {
     8813            if ($key === $this->compileStringContent($this->coerceString($map[1][$i]))) {
     8814                return $i;
     8815            }
     8816        }
     8817
     8818        return null;
    86378819    }
    86388820
     
    86848866    }
    86858867
    8686     protected static $libMapHasKey = ['map', 'key'];
     8868    protected static $libMapHasKey = ['map', 'key', 'keys...'];
    86878869    protected function libMapHasKey($args)
    86888870    {
    86898871        $map = $this->assertMap($args[0], 'map');
    8690 
    8691         return $this->toBool($this->mapHasKey($map, $args[1]));
     8872        if (!isset($args[2])) {
     8873            // BC layer for usages of the function from PHP code rather than from the Sass function
     8874            $args[2] = self::$emptyArgumentList;
     8875        }
     8876        $keys = array_merge([$args[1]], $args[2][2]);
     8877        $lastKey = array_pop($keys);
     8878
     8879        foreach ($keys as $key) {
     8880            $value = $this->mapGet($map, $key);
     8881
     8882            if ($value === null || $value instanceof Number || $value[0] !== Type::T_MAP) {
     8883                return self::$false;
     8884            }
     8885
     8886            $map = $value;
     8887        }
     8888
     8889        return $this->toBool($this->mapHasKey($map, $lastKey));
    86928890    }
    86938891
     
    87128910    protected static $libMapMerge = [
    87138911        ['map1', 'map2'],
    8714         ['map-1', 'map-2']
     8912        ['map-1', 'map-2'],
     8913        ['map1', 'args...']
    87158914    ];
    87168915    protected function libMapMerge($args)
    87178916    {
    87188917        $map1 = $this->assertMap($args[0], 'map1');
    8719         $map2 = $this->assertMap($args[1], 'map2');
    8720 
     8918        $map2 = $args[1];
     8919        $keys = [];
     8920        if ($map2[0] === Type::T_LIST && isset($map2[3]) && \is_array($map2[3])) {
     8921            // This is an argument list for the variadic signature
     8922            if (\count($map2[2]) === 0) {
     8923                throw new SassScriptException('Expected $args to contain a key.');
     8924            }
     8925            if (\count($map2[2]) === 1) {
     8926                throw new SassScriptException('Expected $args to contain a value.');
     8927            }
     8928            $keys = $map2[2];
     8929            $map2 = array_pop($keys);
     8930        }
     8931        $map2 = $this->assertMap($map2, 'map2');
     8932
     8933        return $this->modifyMap($map1, $keys, function ($oldValue) use ($map2) {
     8934            $nestedMap = $this->tryMap($oldValue);
     8935
     8936            if ($nestedMap === null) {
     8937                return $map2;
     8938            }
     8939
     8940            return $this->mergeMaps($nestedMap, $map2);
     8941        });
     8942    }
     8943
     8944    /**
     8945     * @param array    $map
     8946     * @param array    $keys
     8947     * @param callable $modify
     8948     * @param bool     $addNesting
     8949     *
     8950     * @return Number|array
     8951     *
     8952     * @phpstan-param array<Number|array> $keys
     8953     * @phpstan-param callable(Number|array): (Number|array) $modify
     8954     */
     8955    private function modifyMap(array $map, array $keys, callable $modify, $addNesting = true)
     8956    {
     8957        if ($keys === []) {
     8958            return $modify($map);
     8959        }
     8960
     8961        return $this->modifyNestedMap($map, $keys, $modify, $addNesting);
     8962    }
     8963
     8964    /**
     8965     * @param array    $map
     8966     * @param array    $keys
     8967     * @param callable $modify
     8968     * @param bool     $addNesting
     8969     *
     8970     * @return array
     8971     *
     8972     * @phpstan-param non-empty-array<Number|array> $keys
     8973     * @phpstan-param callable(Number|array): (Number|array) $modify
     8974     */
     8975    private function modifyNestedMap(array $map, array $keys, callable $modify, $addNesting)
     8976    {
     8977        $key = array_shift($keys);
     8978
     8979        $nestedValueIndex = $this->mapGetEntryIndex($map, $key);
     8980
     8981        if ($keys === []) {
     8982            if ($nestedValueIndex !== null) {
     8983                $map[2][$nestedValueIndex] = $modify($map[2][$nestedValueIndex]);
     8984            } else {
     8985                $map[1][] = $key;
     8986                $map[2][] = $modify(self::$null);
     8987            }
     8988
     8989            return $map;
     8990        }
     8991
     8992        $nestedMap = $nestedValueIndex !== null ? $this->tryMap($map[2][$nestedValueIndex]) : null;
     8993
     8994        if ($nestedMap === null && !$addNesting) {
     8995            return $map;
     8996        }
     8997
     8998        if ($nestedMap === null) {
     8999            $nestedMap = self::$emptyMap;
     9000        }
     9001
     9002        $newNestedMap = $this->modifyNestedMap($nestedMap, $keys, $modify, $addNesting);
     9003
     9004        if ($nestedValueIndex !== null) {
     9005            $map[2][$nestedValueIndex] = $newNestedMap;
     9006        } else {
     9007            $map[1][] = $key;
     9008            $map[2][] = $newNestedMap;
     9009        }
     9010
     9011        return $map;
     9012    }
     9013
     9014    /**
     9015     * Merges 2 Sass maps together
     9016     *
     9017     * @param array $map1
     9018     * @param array $map2
     9019     *
     9020     * @return array
     9021     */
     9022    private function mergeMaps(array $map1, array $map2)
     9023    {
    87219024        foreach ($map2[1] as $i2 => $key2) {
    8722             $key = $this->compileStringContent($this->coerceString($key2));
    8723 
    8724             foreach ($map1[1] as $i1 => $key1) {
    8725                 if ($key === $this->compileStringContent($this->coerceString($key1))) {
    8726                     $map1[2][$i1] = $map2[2][$i2];
    8727                     continue 2;
    8728                 }
    8729             }
    8730 
    8731             $map1[1][] = $map2[1][$i2];
     9025            $map1EntryIndex = $this->mapGetEntryIndex($map1, $key2);
     9026
     9027            if ($map1EntryIndex !== null) {
     9028                $map1[2][$map1EntryIndex] = $map2[2][$i2];
     9029                continue;
     9030            }
     9031
     9032            $map1[1][] = $key2;
    87329033            $map1[2][] = $map2[2][$i2];
    87339034        }
     
    87779078     * @return string
    87789079     * @throws CompilerException
     9080     *
     9081     * @deprecated
    87799082     */
    87809083    protected function listSeparatorForJoin($list1, $sep)
    87819084    {
     9085        @trigger_error(sprintf('The "%s" method is deprecated.', __METHOD__), E_USER_DEPRECATED);
     9086
    87829087        if (! isset($sep)) {
    87839088            return $list1[1];
     
    87969101    }
    87979102
    8798     protected static $libJoin = ['list1', 'list2', 'separator:null', 'bracketed:auto'];
     9103    protected static $libJoin = ['list1', 'list2', 'separator:auto', 'bracketed:auto'];
    87999104    protected function libJoin($args)
    88009105    {
     
    88039108        $list1 = $this->coerceList($list1, ' ', true);
    88049109        $list2 = $this->coerceList($list2, ' ', true);
    8805         $sep   = $this->listSeparatorForJoin($list1, $sep);
     9110
     9111        switch ($this->compileStringContent($this->assertString($sep, 'separator'))) {
     9112            case 'comma':
     9113                $separator = ',';
     9114                break;
     9115
     9116            case 'space':
     9117                $separator = ' ';
     9118                break;
     9119
     9120            case 'slash':
     9121                $separator = '/';
     9122                break;
     9123
     9124            case 'auto':
     9125                if ($list1[1] !== '' || count($list1[2]) > 1 || !empty($list1['enclosing']) && $list1['enclosing'] !== 'parent') {
     9126                    $separator = $list1[1] ?: ' ';
     9127                } elseif ($list2[1] !== '' || count($list2[2]) > 1 || !empty($list2['enclosing']) && $list2['enclosing'] !== 'parent') {
     9128                    $separator = $list2[1] ?: ' ';
     9129                } else {
     9130                    $separator = ' ';
     9131                }
     9132                break;
     9133
     9134            default:
     9135                throw SassScriptException::forArgument('Must be "space", "comma", "slash", or "auto".', 'separator');
     9136        }
    88069137
    88079138        if ($bracketed === static::$true) {
     
    88309161        }
    88319162
    8832         $res = [Type::T_LIST, $sep, array_merge($list1[2], $list2[2])];
    8833 
    8834         if (isset($list1['enclosing'])) {
    8835             $res['enlcosing'] = $list1['enclosing'];
    8836         }
     9163        $res = [Type::T_LIST, $separator, array_merge($list1[2], $list2[2])];
    88379164
    88389165        if ($bracketed) {
     
    88439170    }
    88449171
    8845     protected static $libAppend = ['list', 'val', 'separator:null'];
     9172    protected static $libAppend = ['list', 'val', 'separator:auto'];
    88469173    protected function libAppend($args)
    88479174    {
     
    88499176
    88509177        $list1 = $this->coerceList($list1, ' ', true);
    8851         $sep   = $this->listSeparatorForJoin($list1, $sep);
    8852         $res   = [Type::T_LIST, $sep, array_merge($list1[2], [$value])];
     9178
     9179        switch ($this->compileStringContent($this->assertString($sep, 'separator'))) {
     9180            case 'comma':
     9181                $separator = ',';
     9182                break;
     9183
     9184            case 'space':
     9185                $separator = ' ';
     9186                break;
     9187
     9188            case 'slash':
     9189                $separator = '/';
     9190                break;
     9191
     9192            case 'auto':
     9193                $separator = $list1[1] === '' && \count($list1[2]) <= 1 && (empty($list1['enclosing']) || $list1['enclosing'] === 'parent') ? ' ' : $list1[1];
     9194                break;
     9195
     9196            default:
     9197                throw SassScriptException::forArgument('Must be "space", "comma", "slash", or "auto".', 'separator');
     9198        }
     9199
     9200        $res = [Type::T_LIST, $separator, array_merge($list1[2], [$value])];
    88539201
    88549202        if (isset($list1['enclosing'])) {
     
    88739221        if (! \is_null($firstList)) {
    88749222            foreach ($firstList[2] as $key => $item) {
    8875                 $list = [Type::T_LIST, '', [$item]];
     9223                $list = [Type::T_LIST, ' ', [$item]];
    88769224
    88779225                foreach ($argLists as $arg) {
     
    92539601                $value['enclosing'] = 'forced_' . $value['enclosing'];
    92549602                $force_enclosing_display = true;
     9603            } elseif (! \count($value[2])) {
     9604                $value['enclosing'] = 'forced_parent';
    92559605            }
    92569606
     
    93769726     * @param array $sub
    93779727     *
    9378      * @return boolean
     9728     * @return bool
    93799729     */
    93809730    protected function isSuperSelector($super, $sub)
     
    94579807     * @param array $subParts
    94589808     *
    9459      * @return boolean
     9809     * @return bool
    94609810     */
    94619811    protected function isSuperPart($superParts, $subParts)
     
    95249874            $appended = [];
    95259875
    9526             foreach ($lastSelectors as $lastSelector) {
    9527                 $previous = $previousSelectors;
    9528 
    9529                 foreach ($lastSelector as $lastSelectorParts) {
    9530                     foreach ($lastSelectorParts as $lastSelectorPart) {
    9531                         foreach ($previous as $i => $previousSelector) {
    9532                             foreach ($previousSelector as $j => $previousSelectorParts) {
    9533                                 $previous[$i][$j][] = $lastSelectorPart;
     9876            foreach ($previousSelectors as $previousSelector) {
     9877                foreach ($lastSelectors as $lastSelector) {
     9878                    $previous = $previousSelector;
     9879                    foreach ($previousSelector as $j => $previousSelectorParts) {
     9880                        foreach ($lastSelector as $lastSelectorParts) {
     9881                            foreach ($lastSelectorParts as $lastSelectorPart) {
     9882                                $previous[$j][] = $lastSelectorPart;
    95349883                            }
    95359884                        }
    95369885                    }
    9537                 }
    9538 
    9539                 foreach ($previous as $ps) {
    9540                     $appended[] = $ps;
     9886
     9887                    $appended[] = $previous;
    95419888                }
    95429889            }
     
    95949941     * used by selector-extend and selector-replace that use the same logic
    95959942     *
    9596      * @param array   $selectors
    9597      * @param array   $extendee
    9598      * @param array   $extender
    9599      * @param boolean $replace
     9943     * @param array $selectors
     9944     * @param array $extendee
     9945     * @param array $extender
     9946     * @param bool  $replace
    96009947     *
    96019948     * @return array
  • wp-scss/trunk/scssphp/src/Compiler/Environment.php

    r2549034 r2820106  
    3333
    3434    /**
     35     * @var Environment|null
     36     */
     37    public $declarationScopeParent;
     38
     39    /**
     40     * @var Environment|null
     41     */
     42    public $parentStore;
     43
     44    /**
     45     * @var array|null
     46     */
     47    public $selectors;
     48
     49    /**
     50     * @var string|null
     51     */
     52    public $marker;
     53
     54    /**
    3555     * @var array
    3656     */
     
    4363
    4464    /**
    45      * @var integer
     65     * @var int
    4666     */
    4767    public $depth;
  • wp-scss/trunk/scssphp/src/Formatter.php

    r2549034 r2820106  
    2626{
    2727    /**
    28      * @var integer
     28     * @var int
    2929     */
    3030    public $indentLevel;
     
    6161
    6262    /**
    63      * @var boolean
     63     * @var bool
    6464     */
    6565    public $keepSemicolons;
     
    7171
    7272    /**
    73      * @var integer
     73     * @var int
    7474     */
    7575    protected $currentLine;
    7676
    7777    /**
    78      * @var integer
     78     * @var int
    7979     */
    8080    protected $currentColumn;
     
    240240     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
    241241     *
    242      * @return boolean
     242     * @return bool
    243243     */
    244244    protected function testEmptyChildren($block)
  • wp-scss/trunk/scssphp/src/Formatter/Compressed.php

    r2549034 r2820106  
    5151            if (substr($line, 0, 2) === '/*' && substr($line, 2, 1) !== '!') {
    5252                unset($block->lines[$index]);
    53             } elseif (substr($line, 0, 3) === '/*!') {
    54                 $block->lines[$index] = '/*' . substr($line, 3);
    5553            }
    5654        }
  • wp-scss/trunk/scssphp/src/Formatter/Nested.php

    r2549034 r2820106  
    2828{
    2929    /**
    30      * @var integer
     30     * @var int
    3131     */
    3232    private $depth;
     
    222222     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
    223223     *
    224      * @return boolean
     224     * @return bool
    225225     */
    226226    private function hasFlatChild($block)
  • wp-scss/trunk/scssphp/src/Formatter/OutputBlock.php

    r2549034 r2820106  
    2828
    2929    /**
    30      * @var integer
     30     * @var int
    3131     */
    3232    public $depth;
     
    5858
    5959    /**
    60      * @var integer|null
     60     * @var int|null
    6161     */
    6262    public $sourceLine;
    6363
    6464    /**
    65      * @var integer|null
     65     * @var int|null
    6666     */
    6767    public $sourceColumn;
  • wp-scss/trunk/scssphp/src/Node.php

    r2549034 r2820106  
    2828
    2929    /**
    30      * @var integer
     30     * @var int
    3131     */
    3232    public $sourceIndex;
  • wp-scss/trunk/scssphp/src/Node/Number.php

    r2549034 r2820106  
    3939
    4040    /**
    41      * @var integer
     41     * @var int
    4242     * @deprecated use {Number::PRECISION} instead to read the precision. Configuring it is not supported anymore.
    4343     */
     
    8282
    8383    /**
    84      * @var integer|float
     84     * @var int|float
    8585     */
    8686    private $dimension;
     
    101101     * Initialize number
    102102     *
    103      * @param integer|float   $dimension
     103     * @param int|float       $dimension
    104104     * @param string[]|string $numeratorUnits
    105105     * @param string[]        $denominatorUnits
     
    148148
    149149    /**
    150      * {@inheritdoc}
    151      */
     150     * @return bool
     151     */
     152    #[\ReturnTypeWillChange]
    152153    public function offsetExists($offset)
    153154    {
     
    173174
    174175    /**
    175      * {@inheritdoc}
    176      */
     176     * @return mixed
     177     */
     178    #[\ReturnTypeWillChange]
    177179    public function offsetGet($offset)
    178180    {
     
    199201
    200202    /**
    201      * {@inheritdoc}
    202      */
     203     * @return void
     204     */
     205    #[\ReturnTypeWillChange]
    203206    public function offsetSet($offset, $value)
    204207    {
     
    207210
    208211    /**
    209      * {@inheritdoc}
    210      */
     212     * @return void
     213     */
     214    #[\ReturnTypeWillChange]
    211215    public function offsetUnset($offset)
    212216    {
     
    217221     * Returns true if the number is unitless
    218222     *
    219      * @return boolean
     223     * @return bool
    220224     */
    221225    public function unitless()
  • wp-scss/trunk/scssphp/src/Parser.php

    r2549034 r2820106  
    1313namespace ScssPhp\ScssPhp;
    1414
     15use ScssPhp\ScssPhp\Block\AtRootBlock;
     16use ScssPhp\ScssPhp\Block\CallableBlock;
     17use ScssPhp\ScssPhp\Block\ContentBlock;
     18use ScssPhp\ScssPhp\Block\DirectiveBlock;
     19use ScssPhp\ScssPhp\Block\EachBlock;
     20use ScssPhp\ScssPhp\Block\ElseBlock;
     21use ScssPhp\ScssPhp\Block\ElseifBlock;
     22use ScssPhp\ScssPhp\Block\ForBlock;
     23use ScssPhp\ScssPhp\Block\IfBlock;
     24use ScssPhp\ScssPhp\Block\MediaBlock;
     25use ScssPhp\ScssPhp\Block\NestedPropertyBlock;
     26use ScssPhp\ScssPhp\Block\WhileBlock;
    1527use ScssPhp\ScssPhp\Exception\ParserException;
    1628use ScssPhp\ScssPhp\Logger\LoggerInterface;
     
    126138     *
    127139     * @param string|null          $sourceName
    128      * @param integer              $sourceIndex
     140     * @param int                  $sourceIndex
    129141     * @param string|null          $encoding
    130142     * @param Cache|null           $cache
     
    306318     * @param string|array $out
    307319     *
    308      * @return boolean
     320     * @return bool
    309321     */
    310322    public function parseValue($buffer, &$out)
     
    335347     * @param bool         $shouldValidate
    336348     *
    337      * @return boolean
     349     * @return bool
    338350     */
    339351    public function parseSelector($buffer, &$out, $shouldValidate = true)
     
    372384     * @param string|array $out
    373385     *
    374      * @return boolean
     386     * @return bool
    375387     */
    376388    public function parseMediaQueryList($buffer, &$out)
     
    429441     * go back where we started.
    430442     *
    431      * @return boolean
     443     * @return bool
    432444     */
    433445    protected function parseChunk()
     
    448460                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    449461
    450                 $atRoot = $this->pushSpecialBlock(Type::T_AT_ROOT, $s);
     462                $atRoot = new AtRootBlock();
     463                $this->registerPushedBlock($atRoot, $s);
    451464                $atRoot->selector = $selector;
    452465                $atRoot->with     = $with;
     
    462475                $this->matchChar('{', false)
    463476            ) {
    464                 $media = $this->pushSpecialBlock(Type::T_MEDIA, $s);
     477                $media = new MediaBlock();
     478                $this->registerPushedBlock($media, $s);
    465479                $media->queryList = $mediaQueryList[2];
    466480
     
    478492                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    479493
    480                 $mixin = $this->pushSpecialBlock(Type::T_MIXIN, $s);
     494                $mixin = new CallableBlock(Type::T_MIXIN);
     495                $this->registerPushedBlock($mixin, $s);
    481496                $mixin->name = $mixinName;
    482497                $mixin->args = $args;
     
    510525
    511526                if (! empty($hasBlock)) {
    512                     $include = $this->pushSpecialBlock(Type::T_INCLUDE, $s);
     527                    $include = new ContentBlock();
     528                    $this->registerPushedBlock($include, $s);
    513529                    $include->child = $child;
    514530                } else {
     
    600616                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    601617
    602                 $func = $this->pushSpecialBlock(Type::T_FUNCTION, $s);
     618                $func = new CallableBlock(Type::T_FUNCTION);
     619                $this->registerPushedBlock($func, $s);
    603620                $func->name = $fnName;
    604621                $func->args = $args;
     
    632649                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    633650
    634                 $each = $this->pushSpecialBlock(Type::T_EACH, $s);
     651                $each = new EachBlock();
     652                $this->registerPushedBlock($each, $s);
    635653
    636654                foreach ($varNames[2] as $varName) {
     
    661679                }
    662680
    663                 $while = $this->pushSpecialBlock(Type::T_WHILE, $s);
     681                $while = new WhileBlock();
     682                $this->registerPushedBlock($while, $s);
    664683                $while->cond = $cond;
    665684
     
    681700                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    682701
    683                 $for = $this->pushSpecialBlock(Type::T_FOR, $s);
     702                $for = new ForBlock();
     703                $this->registerPushedBlock($for, $s);
    684704                $for->var   = $varName[1];
    685705                $for->start = $start;
     
    698718                ! $this->cssOnly || $this->assertPlainCssValid(false, $s);
    699719
    700                 $if = $this->pushSpecialBlock(Type::T_IF, $s);
     720                $if = new IfBlock();
     721                $this->registerPushedBlock($if, $s);
    701722
    702723                while (
     
    777798            if (isset($last) && $last[0] === Type::T_IF) {
    778799                list(, $if) = $last;
     800                assert($if instanceof IfBlock);
    779801
    780802                if ($this->literal('@else', 5)) {
    781803                    if ($this->matchChar('{', false)) {
    782                         $else = $this->pushSpecialBlock(Type::T_ELSE, $s);
     804                        $else = new ElseBlock();
    783805                    } elseif (
    784806                        $this->literal('if', 2) &&
    785807                        $this->functionCallArgumentsList($cond, false, '{', false)
    786808                    ) {
    787                         $else = $this->pushSpecialBlock(Type::T_ELSEIF, $s);
     809                        $else = new ElseifBlock();
    788810                        $else->cond = $cond;
    789811                    }
    790812
    791813                    if (isset($else)) {
    792                         $else->dontAppend = true;
     814                        $this->registerPushedBlock($else, $s);
    793815                        $if->cases[] = $else;
    794816
     
    828850                ($t2 = $this->matchChar('{', false))
    829851            ) {
    830                 $directive = $this->pushSpecialBlock(Type::T_DIRECTIVE, $s);
     852                $directive = new DirectiveBlock();
     853                $this->registerPushedBlock($directive, $s);
    831854                $directive->name  = 'supports';
    832855                $directive->value = $supportQuery;
     
    849872                }
    850873                if ($dirName === 'media') {
    851                     $directive = $this->pushSpecialBlock(Type::T_MEDIA, $s);
     874                    $directive = new MediaBlock();
    852875                } else {
    853                     $directive = $this->pushSpecialBlock(Type::T_DIRECTIVE, $s);
     876                    $directive = new DirectiveBlock();
    854877                    $directive->name = $dirName;
    855878                }
     879                $this->registerPushedBlock($directive, $s);
    856880
    857881                if (isset($dirValue)) {
     
    10291053                ! $this->cssOnly || $this->assertPlainCssValid(false);
    10301054
    1031                 $propBlock = $this->pushSpecialBlock(Type::T_NESTED_PROPERTY, $s);
     1055                $propBlock = new NestedPropertyBlock();
     1056                $this->registerPushedBlock($propBlock, $s);
    10321057                $propBlock->prefix = $name;
    10331058                $propBlock->hasValue = $foundSomething;
     
    10551080            }
    10561081
    1057             if (isset($block->type) && $block->type === Type::T_INCLUDE) {
     1082            if ($block instanceof ContentBlock) {
    10581083                $include = $block->child;
     1084                assert(\is_array($include));
    10591085                unset($block->child);
    10601086                $include[3] = $block;
    10611087                $this->append($include, $s);
    1062             } elseif (empty($block->dontAppend)) {
     1088            } elseif (!$block instanceof ElseBlock && !$block instanceof ElseifBlock) {
    10631089                $type = isset($block->type) ? $block->type : Type::T_BLOCK;
    10641090                $this->append([$type, $block], $s);
     
    10891115     *
    10901116     * @param array|null $selectors
    1091      * @param integer $pos
     1117     * @param int        $pos
    10921118     *
    10931119     * @return Block
     
    10951121    protected function pushBlock($selectors, $pos = 0)
    10961122    {
     1123        $b = new Block();
     1124        $b->selectors = $selectors;
     1125
     1126        $this->registerPushedBlock($b, $pos);
     1127
     1128        return $b;
     1129    }
     1130
     1131    /**
     1132     * @param Block $b
     1133     * @param int   $pos
     1134     *
     1135     * @return void
     1136     */
     1137    private function registerPushedBlock(Block $b, $pos)
     1138    {
    10971139        list($line, $column) = $this->getSourcePosition($pos);
    10981140
    1099         $b = new Block();
    11001141        $b->sourceName   = $this->sourceName;
    11011142        $b->sourceLine   = $line;
    11021143        $b->sourceColumn = $column;
    11031144        $b->sourceIndex  = $this->sourceIndex;
    1104         $b->selectors    = $selectors;
    11051145        $b->comments     = [];
    11061146        $b->parent       = $this->env;
     
    11271167            }
    11281168        }
    1129 
    1130         return $b;
    11311169    }
    11321170
     
    11341172     * Push special (named) block onto parse tree
    11351173     *
     1174     * @deprecated
     1175     *
    11361176     * @param string  $type
    1137      * @param integer $pos
     1177     * @param int    $pos
    11381178     *
    11391179     * @return Block
     
    11841224     * Peek input stream
    11851225     *
    1186      * @param string  $regex
    1187      * @param array   $out
    1188      * @param integer $from
    1189      *
    1190      * @return integer
     1226     * @param string $regex
     1227     * @param array  $out
     1228     * @param int    $from
     1229     *
     1230     * @return int
    11911231     */
    11921232    protected function peek($regex, &$out, $from = null)
     
    12051245     * Seek to position in input stream (or return current position in input stream)
    12061246     *
    1207      * @param integer $where
     1247     * @param int $where
    12081248     */
    12091249    protected function seek($where)
     
    12161256     *
    12171257     * @param array|false $parsed
    1218      * @param int $startPos
     1258     * @param int         $startPos
     1259     *
    12191260     * @throws ParserException
    12201261     */
     
    12441285    /**
    12451286     * Check a parsed element is plain CSS Valid
     1287     *
    12461288     * @param array $parsed
     1289     * @param bool  $allowExpression
     1290     *
    12471291     * @return bool|array
    12481292     */
     
    14241468     * @param string $delim Delimiter
    14251469     *
    1426      * @return boolean True if match; false otherwise
     1470     * @return bool True if match; false otherwise
    14271471     */
    14281472    protected function matchString(&$m, $delim)
     
    14601504     * Try to match something on head of buffer
    14611505     *
    1462      * @param string  $regex
    1463      * @param array   $out
    1464      * @param boolean $eatWhitespace
    1465      *
    1466      * @return boolean
     1506     * @param string $regex
     1507     * @param array  $out
     1508     * @param bool  $eatWhitespace
     1509     *
     1510     * @return bool
    14671511     */
    14681512    protected function match($regex, &$out, $eatWhitespace = null)
     
    14901534     * Match a single string
    14911535     *
    1492      * @param string  $char
    1493      * @param boolean $eatWhitespace
    1494      *
    1495      * @return boolean
     1536     * @param string $char
     1537     * @param bool  $eatWhitespace
     1538     *
     1539     * @return bool
    14961540     */
    14971541    protected function matchChar($char, $eatWhitespace = null)
     
    15171561     * Match literal string
    15181562     *
    1519      * @param string  $what
    1520      * @param integer $len
    1521      * @param boolean $eatWhitespace
    1522      *
    1523      * @return boolean
     1563     * @param string $what
     1564     * @param int    $len
     1565     * @param bool  $eatWhitespace
     1566     *
     1567     * @return bool
    15241568     */
    15251569    protected function literal($what, $len, $eatWhitespace = null)
     
    15451589     * Match some whitespace
    15461590     *
    1547      * @return boolean
     1591     * @return bool
    15481592     */
    15491593    protected function whitespace()
     
    15811625                        list($line, $column) = $this->getSourcePosition($this->count);
    15821626                        $file = $this->sourceName;
    1583                         $this->logger->warn("Unterminated interpolations in multiline comments are deprecated and will be removed in ScssPhp 2.0, in \"$file\", line $line, column $column.", true);
     1627                        if (!$this->discardComments) {
     1628                            $this->logger->warn("Unterminated interpolations in multiline comments are deprecated and will be removed in ScssPhp 2.0, in \"$file\", line $line, column $column.", true);
     1629                        }
    15841630                        $comment[] = substr($this->buffer, $this->count, 2);
    15851631
     
    16421688     *
    16431689     * @param array|null $statement
    1644      * @param integer $pos
     1690     * @param int        $pos
    16451691     */
    16461692    protected function append($statement, $pos = null)
     
    16871733     * @param array $out
    16881734     *
    1689      * @return boolean
     1735     * @return bool
    16901736     */
    16911737    protected function mediaQueryList(&$out)
     
    16991745     * @param array $out
    17001746     *
    1701      * @return boolean
     1747     * @return bool
    17021748     */
    17031749    protected function mediaQuery(&$out)
     
    17531799     * @param array $out
    17541800     *
    1755      * @return boolean
     1801     * @return bool
    17561802     */
    17571803    protected function supportsQuery(&$out)
     
    18861932     * @param array $out
    18871933     *
    1888      * @return boolean
     1934     * @return bool
    18891935     */
    18901936    protected function mediaExpression(&$out)
     
    19191965     * @param array $out
    19201966     *
    1921      * @return boolean
     1967     * @return bool
    19221968     */
    19231969    protected function argValues(&$out)
     
    19441990     * @param array $out
    19451991     *
    1946      * @return boolean
     1992     * @return bool
    19471993     */
    19481994    protected function argValue(&$out)
     
    20242070     * Parse directive value list that considers $vars as keyword
    20252071     *
    2026      * @param array          $out
    2027      * @param boolean|string $endChar
    2028      *
    2029      * @return boolean
     2072     * @param array       $out
     2073     * @param bool|string $endChar
     2074     *
     2075     * @return bool
    20302076     */
    20312077    protected function directiveValue(&$out, $endChar = false)
     
    20882134     * @param array $out
    20892135     *
    2090      * @return boolean
     2136     * @return bool
    20912137     */
    20922138    protected function valueList(&$out)
     
    21042150     * and not of the value list
    21052151     *
    2106      * @param $out
    2107      * @param bool $mandatoryEnclos
     2152     * @param array       $out
     2153     * @param bool        $mandatoryEnclos
    21082154     * @param null|string $charAfter
    2109      * @param null|bool $eatWhiteSp
     2155     * @param null|bool   $eatWhiteSp
     2156     *
    21102157     * @return bool
    21112158     */
     
    21442191     * @param array $out
    21452192     *
    2146      * @return boolean
     2193     * @return bool
    21472194     */
    21482195    protected function spaceList(&$out)
     
    21542201     * Parse generic list
    21552202     *
    2156      * @param array   $out
    2157      * @param string  $parseItem The name of the method used to parse items
    2158      * @param string  $delim
    2159      * @param boolean $flatten
    2160      *
    2161      * @return boolean
     2203     * @param array  $out
     2204     * @param string $parseItem The name of the method used to parse items
     2205     * @param string $delim
     2206     * @param bool  $flatten
     2207     *
     2208     * @return bool
    21622209     */
    21632210    protected function genericList(&$out, $parseItem, $delim = '', $flatten = true)
     
    22552302     * Parse expression
    22562303     *
    2257      * @param array   $out
    2258      * @param boolean $listOnly
    2259      * @param boolean $lookForExp
    2260      *
    2261      * @return boolean
     2304     * @param array $out
     2305     * @param bool  $listOnly
     2306     * @param bool  $lookForExp
     2307     *
     2308     * @return bool
    22622309     */
    22632310    protected function expression(&$out, $listOnly = false, $lookForExp = true)
     
    23212368     *
    23222369     * @param array   $out
    2323      * @param integer $s
     2370     * @param int    $s
    23242371     * @param string  $closingParen
    23252372     * @param array   $allowedTypes
    23262373     *
    2327      * @return boolean
     2374     * @return bool
    23282375     */
    23292376    protected function enclosedExpression(&$out, $s, $closingParen = ')', $allowedTypes = [Type::T_LIST, Type::T_MAP])
     
    23802427     * Parse left-hand side of subexpression
    23812428     *
    2382      * @param array   $lhs
    2383      * @param integer $minP
     2429     * @param array $lhs
     2430     * @param int  $minP
    23842431     *
    23852432     * @return array
     
    24162463            }
    24172464
    2418             // peek and see if rhs belongs to next operator
    2419             if ($this->peek($operators, $next) && static::$precedence[$next[1]] > static::$precedence[$op]) {
    2420                 $rhs = $this->expHelper($rhs, static::$precedence[$next[1]]);
    2421             }
     2465            // consume higher-precedence operators on the right-hand side
     2466            $rhs = $this->expHelper($rhs, static::$precedence[$op] + 1);
    24222467
    24232468            $lhs = [Type::T_EXPRESSION, $op, $lhs, $rhs, $this->inParens, $whiteBefore, $whiteAfter];
     
    24382483     * @param array $out
    24392484     *
    2440      * @return boolean
     2485     * @return bool
    24412486     */
    24422487    protected function value(&$out)
     
    26462691     * @param array $out
    26472692     *
    2648      * @return boolean
     2693     * @return bool
    26492694     */
    26502695    protected function parenValue(&$out)
     
    26852730     * @param array $out
    26862731     *
    2687      * @return boolean
     2732     * @return bool
    26882733     */
    26892734    protected function progid(&$out)
     
    27182763     * @param array  $func
    27192764     *
    2720      * @return boolean
     2765     * @return bool
    27212766     */
    27222767    protected function func($name, &$func)
     
    27722817     * @param array $out
    27732818     *
    2774      * @return boolean
     2819     * @return bool
    27752820     */
    27762821    protected function argumentList(&$out)
     
    28172862     * @param array $out
    28182863     *
    2819      * @return boolean
     2864     * @return bool
    28202865     */
    28212866    protected function argumentDef(&$out)
     
    28792924     * @param array $out
    28802925     *
    2881      * @return boolean
     2926     * @return bool
    28822927     */
    28832928    protected function map(&$out)
     
    29212966     * @param array $out
    29222967     *
    2923      * @return boolean
     2968     * @return bool
    29242969     */
    29252970    protected function color(&$out)
     
    29472992     * @param array $unit
    29482993     *
    2949      * @return boolean
     2994     * @return bool
    29502995     */
    29512996    protected function unit(&$unit)
     
    29723017     *
    29733018     * @param array $out
    2974      *
    2975      * @return boolean
     3019     * @param bool  $keepDelimWithInterpolation
     3020     *
     3021     * @return bool
    29763022     */
    29773023    protected function string(&$out, $keepDelimWithInterpolation = false)
     
    30543100    /**
    30553101     * @param string $out
    3056      * @param bool $inKeywords
     3102     * @param bool   $inKeywords
     3103     *
    30573104     * @return bool
    30583105     */
     
    31043151     * Parse keyword or interpolation
    31053152     *
    3106      * @param array   $out
    3107      * @param boolean $restricted
    3108      *
    3109      * @return boolean
     3153     * @param array $out
     3154     * @param bool  $restricted
     3155     *
     3156     * @return bool
    31103157     */
    31113158    protected function mixedKeyword(&$out, $restricted = false)
     
    31483195     * Parse an unbounded string stopped by $end
    31493196     *
    3150      * @param string  $end
    3151      * @param array   $out
    3152      * @param string  $nestOpen
    3153      * @param string  $nestClose
    3154      * @param boolean $rtrim
     3197     * @param string $end
     3198     * @param array  $out
     3199     * @param string $nestOpen
     3200     * @param string $nestClose
     3201     * @param bool  $rtrim
    31553202     * @param string $disallow
    31563203     *
    3157      * @return boolean
     3204     * @return bool
    31583205     */
    31593206    protected function openString($end, &$out, $nestOpen = null, $nestClose = null, $rtrim = true, $disallow = null)
     
    32313278     *
    32323279     * @param string|array $out
    3233      * @param boolean      $lookWhite save information about whitespace before and after
    3234      *
    3235      * @return boolean
     3280     * @param bool         $lookWhite save information about whitespace before and after
     3281     *
     3282     * @return bool
    32363283     */
    32373284    protected function interpolation(&$out, $lookWhite = true)
     
    32883335     * @param array $out
    32893336     *
    3290      * @return boolean
     3337     * @return bool
    32913338     */
    32923339    protected function propertyName(&$out)
     
    33433390     * @param array $out
    33443391     *
    3345      * @return boolean
     3392     * @return bool
    33463393     */
    33473394    protected function customProperty(&$out)
     
    34013448     *
    34023449     * @param array $out
    3403      * @param string|boolean $subSelector
    3404      *
    3405      * @return boolean
     3450     * @param string|bool $subSelector
     3451     *
     3452     * @return bool
    34063453     */
    34073454    protected function selectors(&$out, $subSelector = false)
     
    34373484     *
    34383485     * @param array          $out
    3439      * @param string|boolean $subSelector
    3440      *
    3441      * @return boolean
     3486     * @param string|bool $subSelector
     3487     *
     3488     * @return bool
    34423489     */
    34433490    protected function selector(&$out, $subSelector = false)
     
    34953542     *
    34963543     * @param string $out
    3497      * @param bool $keepEscapedNumber
     3544     * @param bool   $keepEscapedNumber
     3545     *
    34983546     * @return bool
    34993547     */
     
    35403588     *
    35413589     * @param array          $out
    3542      * @param string|boolean $subSelector
    3543      *
    3544      * @return boolean
     3590     * @param string|bool $subSelector
     3591     *
     3592     * @return bool
    35453593     */
    35463594    protected function selectorSingle(&$out, $subSelector = false)
     
    37663814     * @param array $out
    37673815     *
    3768      * @return boolean
     3816     * @return bool
    37693817     */
    37703818    protected function variable(&$out)
     
    37933841     * Parse a keyword
    37943842     *
    3795      * @param string  $word
    3796      * @param boolean $eatWhitespace
    3797      * @param boolean $inSelector
    3798      *
    3799      * @return boolean
     3843     * @param string $word
     3844     * @param bool  $eatWhitespace
     3845     * @param bool  $inSelector
     3846     *
     3847     * @return bool
    38003848     */
    38013849    protected function keyword(&$word, $eatWhitespace = null, $inSelector = false)
     
    38603908     * Parse a keyword that should not start with a number
    38613909     *
    3862      * @param string  $word
    3863      * @param boolean $eatWhitespace
    3864      * @param boolean $inSelector
    3865      *
    3866      * @return boolean
     3910     * @param string $word
     3911     * @param bool  $eatWhitespace
     3912     * @param bool  $inSelector
     3913     *
     3914     * @return bool
    38673915     */
    38683916    protected function restrictedKeyword(&$word, $eatWhitespace = null, $inSelector = false)
     
    38843932     * @param string|array $placeholder
    38853933     *
    3886      * @return boolean
     3934     * @return bool
    38873935     */
    38883936    protected function placeholder(&$placeholder)
     
    39133961     * @param array $out
    39143962     *
    3915      * @return boolean
     3963     * @return bool
    39163964     */
    39173965    protected function url(&$out)
     
    39483996     * @param bool $eatWhitespace
    39493997     *
    3950      * @return boolean
     3998     * @return bool
    39513999     */
    39524000    protected function end($eatWhitespace = null)
     
    40664114     * Get source line number and column (given character position in the buffer)
    40674115     *
    4068      * @param integer $pos
     4116     * @param int $pos
    40694117     *
    40704118     * @return array
  • wp-scss/trunk/scssphp/src/SourceMap/Base64.php

    r2549034 r2820106  
    165165     * Convert to base64
    166166     *
    167      * @param integer $value
     167     * @param int $value
    168168     *
    169169     * @return string
     
    179179     * @param string $value
    180180     *
    181      * @return integer
     181     * @return int
    182182     */
    183183    public static function decode($value)
  • wp-scss/trunk/scssphp/src/SourceMap/Base64VLQ.php

    r2549034 r2820106  
    5252     * Returns the VLQ encoded value.
    5353     *
    54      * @param integer $value
     54     * @param int $value
    5555     *
    5656     * @return string
     
    8181     *
    8282     * @param string $str
    83      * @param integer $index
     83     * @param int    $index
    8484     *
    85      * @return integer
     85     * @return int
    8686     */
    8787    public static function decode($str, &$index)
     
    108108     *   2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
    109109     *
    110      * @param integer $value
     110     * @param int $value
    111111     *
    112      * @return integer
     112     * @return int
    113113     */
    114114    private static function toVLQSigned($value)
     
    127127     *   4 (100 binary) becomes 2, 5 (101 binary) becomes -2
    128128     *
    129      * @param integer $value
     129     * @param int $value
    130130     *
    131      * @return integer
     131     * @return int
    132132     */
    133133    private static function fromVLQSigned($value)
  • wp-scss/trunk/scssphp/src/SourceMap/SourceMapGenerator.php

    r2549034 r2820106  
    115115     * Adds a mapping
    116116     *
    117      * @param integer $generatedLine   The line number in generated file
    118      * @param integer $generatedColumn The column number in generated file
    119      * @param integer $originalLine    The line number in original file
    120      * @param integer $originalColumn  The column number in original file
    121      * @param string  $sourceFile      The original source file
     117     * @param int    $generatedLine   The line number in generated file
     118     * @param int    $generatedColumn The column number in generated file
     119     * @param int    $originalLine    The line number in original file
     120     * @param int    $originalColumn  The column number in original file
     121     * @param string $sourceFile      The original source file
    122122     *
    123123     * @return void
     
    327327     * @param string $filename
    328328     *
    329      * @return integer|false
     329     * @return int|false
    330330     */
    331331    protected function findFileIndex($filename)
     
    363363     * Fix windows paths
    364364     *
    365      * @param string  $path
    366      * @param boolean $addEndSlash
     365     * @param string $path
     366     * @param bool  $addEndSlash
    367367     *
    368368     * @return string
  • wp-scss/trunk/scssphp/src/Type.php

    r2549034 r2820106  
    2020class Type
    2121{
     22    /**
     23     * @internal
     24     */
    2225    const T_ASSIGN = 'assign';
     26    /**
     27     * @internal
     28     */
    2329    const T_AT_ROOT = 'at-root';
     30    /**
     31     * @internal
     32     */
    2433    const T_BLOCK = 'block';
    25     /** @deprecated */
     34    /**
     35     * @deprecated
     36     * @internal
     37     */
    2638    const T_BREAK = 'break';
     39    /**
     40     * @internal
     41     */
    2742    const T_CHARSET = 'charset';
    2843    const T_COLOR = 'color';
     44    /**
     45     * @internal
     46     */
    2947    const T_COMMENT = 'comment';
    30     /** @deprecated */
     48    /**
     49     * @deprecated
     50     * @internal
     51     */
    3152    const T_CONTINUE = 'continue';
    32     /** @deprecated */
     53    /**
     54     * @deprecated
     55     * @internal
     56     */
    3357    const T_CONTROL = 'control';
     58    /**
     59     * @internal
     60     */
    3461    const T_CUSTOM_PROPERTY = 'custom';
     62    /**
     63     * @internal
     64     */
    3565    const T_DEBUG = 'debug';
     66    /**
     67     * @internal
     68     */
    3669    const T_DIRECTIVE = 'directive';
     70    /**
     71     * @internal
     72     */
    3773    const T_EACH = 'each';
     74    /**
     75     * @internal
     76     */
    3877    const T_ELSE = 'else';
     78    /**
     79     * @internal
     80     */
    3981    const T_ELSEIF = 'elseif';
     82    /**
     83     * @internal
     84     */
    4085    const T_ERROR = 'error';
     86    /**
     87     * @internal
     88     */
    4189    const T_EXPRESSION = 'exp';
     90    /**
     91     * @internal
     92     */
    4293    const T_EXTEND = 'extend';
     94    /**
     95     * @internal
     96     */
    4397    const T_FOR = 'for';
    4498    const T_FUNCTION = 'function';
     99    /**
     100     * @internal
     101     */
    45102    const T_FUNCTION_REFERENCE = 'function-reference';
     103    /**
     104     * @internal
     105     */
    46106    const T_FUNCTION_CALL = 'fncall';
     107    /**
     108     * @internal
     109     */
    47110    const T_HSL = 'hsl';
     111    /**
     112     * @internal
     113     */
    48114    const T_HWB = 'hwb';
     115    /**
     116     * @internal
     117     */
    49118    const T_IF = 'if';
     119    /**
     120     * @internal
     121     */
    50122    const T_IMPORT = 'import';
     123    /**
     124     * @internal
     125     */
    51126    const T_INCLUDE = 'include';
     127    /**
     128     * @internal
     129     */
    52130    const T_INTERPOLATE = 'interpolate';
     131    /**
     132     * @internal
     133     */
    53134    const T_INTERPOLATED = 'interpolated';
     135    /**
     136     * @internal
     137     */
    54138    const T_KEYWORD = 'keyword';
    55139    const T_LIST = 'list';
    56140    const T_MAP = 'map';
     141    /**
     142     * @internal
     143     */
    57144    const T_MEDIA = 'media';
     145    /**
     146     * @internal
     147     */
    58148    const T_MEDIA_EXPRESSION = 'mediaExp';
     149    /**
     150     * @internal
     151     */
    59152    const T_MEDIA_TYPE = 'mediaType';
     153    /**
     154     * @internal
     155     */
    60156    const T_MEDIA_VALUE = 'mediaValue';
     157    /**
     158     * @internal
     159     */
    61160    const T_MIXIN = 'mixin';
     161    /**
     162     * @internal
     163     */
    62164    const T_MIXIN_CONTENT = 'mixin_content';
     165    /**
     166     * @internal
     167     */
    63168    const T_NESTED_PROPERTY = 'nestedprop';
     169    /**
     170     * @internal
     171     */
    64172    const T_NOT = 'not';
    65173    const T_NULL = 'null';
    66174    const T_NUMBER = 'number';
     175    /**
     176     * @internal
     177     */
    67178    const T_RETURN = 'return';
     179    /**
     180     * @internal
     181     */
    68182    const T_ROOT = 'root';
     183    /**
     184     * @internal
     185     */
    69186    const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
     187    /**
     188     * @internal
     189     */
    70190    const T_SELF = 'self';
    71191    const T_STRING = 'string';
     192    /**
     193     * @internal
     194     */
    72195    const T_UNARY = 'unary';
     196    /**
     197     * @internal
     198     */
    73199    const T_VARIABLE = 'var';
     200    /**
     201     * @internal
     202     */
    74203    const T_WARN = 'warn';
     204    /**
     205     * @internal
     206     */
    75207    const T_WHILE = 'while';
    76208}
  • wp-scss/trunk/scssphp/src/Util.php

    r2549034 r2820106  
    8080     * mb_chr() wrapper
    8181     *
    82      * @param integer $code
     82     * @param int $code
    8383     *
    8484     * @return string
  • wp-scss/trunk/scssphp/src/Version.php

    r2549034 r2820106  
    2020class Version
    2121{
    22     const VERSION = '1.5.2';
     22    const VERSION = '1.10.0';
    2323}
  • wp-scss/trunk/wp-scss.php

    r2616813 r2820106  
    44 * Plugin URI: https://github.com/ConnectThink/WP-SCSS
    55 * Description: Compiles scss files live on WordPress.
    6  * Version: 2.4.0
     6 * Version: 3.0.0
    77 * Author: Connect Think
    88 * Author URI: http://connectthink.com
     
    4545
    4646if (!defined('WPSCSS_VERSION_NUM'))
    47   define('WPSCSS_VERSION_NUM', '2.4.0');
     47  define('WPSCSS_VERSION_NUM', '3.0.0');
    4848
    4949// Add version to options table
Note: See TracChangeset for help on using the changeset viewer.