Skip to content

Commit f3bb6b7

Browse files
committed
Change self:: to static:: where possible
1 parent 10c6505 commit f3bb6b7

File tree

4 files changed

+74
-74
lines changed

4 files changed

+74
-74
lines changed

src/Compiler.php

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ protected function compileAtRoot(Block $block)
729729
{
730730
$env = $this->pushEnv($block);
731731
$envs = $this->compactEnv($env);
732-
$without = isset($block->with) ? $this->compileWith($block->with) : self::WITH_RULE;
732+
$without = isset($block->with) ? $this->compileWith($block->with) : static::WITH_RULE;
733733

734734
// wrap inline selector
735735
if ($block->selector) {
@@ -854,12 +854,12 @@ private function compileWith($with)
854854
];
855855

856856
// exclude selectors by default
857-
$without = self::WITH_RULE;
857+
$without = static::WITH_RULE;
858858

859-
if ($this->libMapHasKey([$with, self::$with])) {
860-
$without = self::WITH_ALL;
859+
if ($this->libMapHasKey([$with, static::$with])) {
860+
$without = static::WITH_ALL;
861861

862-
$list = $this->coerceList($this->libMapGet([$with, self::$with]));
862+
$list = $this->coerceList($this->libMapGet([$with, static::$with]));
863863

864864
foreach ($list[2] as $item) {
865865
$keyword = $this->compileStringContent($this->coerceString($item));
@@ -870,10 +870,10 @@ private function compileWith($with)
870870
}
871871
}
872872

873-
if ($this->libMapHasKey([$with, self::$without])) {
873+
if ($this->libMapHasKey([$with, static::$without])) {
874874
$without = 0;
875875

876-
$list = $this->coerceList($this->libMapGet([$with, self::$without]));
876+
$list = $this->coerceList($this->libMapGet([$with, static::$without]));
877877

878878
foreach ($list[2] as $item) {
879879
$keyword = $this->compileStringContent($this->coerceString($item));
@@ -920,10 +920,10 @@ private function filterWithout($envs, $without)
920920
*/
921921
private function isWithout($without, Block $block)
922922
{
923-
if ((($without & self::WITH_RULE) && isset($block->selectors)) ||
924-
(($without & self::WITH_MEDIA) &&
923+
if ((($without & static::WITH_RULE) && isset($block->selectors)) ||
924+
(($without & static::WITH_MEDIA) &&
925925
isset($block->type) && $block->type === Type::T_MEDIA) ||
926-
(($without & self::WITH_SUPPORTS) &&
926+
(($without & static::WITH_SUPPORTS) &&
927927
isset($block->type) && $block->type === Type::T_DIRECTIVE &&
928928
isset($block->name) && $block->name === 'supports')
929929
) {
@@ -1014,13 +1014,13 @@ protected function compileBlock(Block $block)
10141014
$line = $block->sourceLine;
10151015

10161016
switch ($this->lineNumberStyle) {
1017-
case self::LINE_COMMENTS:
1017+
case static::LINE_COMMENTS:
10181018
$annotation->lines[] = '/* line ' . $line
10191019
. ($file ? ', ' . $file : '')
10201020
. ' */';
10211021
break;
10221022

1023-
case self::DEBUG_INFO:
1023+
case static::DEBUG_INFO:
10241024
$annotation->lines[] = '@media -sass-debug-info{'
10251025
. ($file ? 'filename{font-family:"' . $file . '"}' : '')
10261026
. 'line{font-family:' . $line . '}}';
@@ -1583,7 +1583,7 @@ protected function compileChild($child, OutputBlock $out)
15831583

15841584
$shouldSet = $isDefault &&
15851585
(($result = $this->get($name[1], false)) === null
1586-
|| $result === self::$null);
1586+
|| $result === static::$null);
15871587

15881588
if (! $isDefault || $shouldSet) {
15891589
$this->set($name[1], $this->reduce($value));
@@ -1611,7 +1611,7 @@ protected function compileChild($child, OutputBlock $out)
16111611
if ($value[0] !== Type::T_NULL) {
16121612
$value = $this->reduce($value);
16131613

1614-
if ($value[0] === Type::T_NULL || $value === self::$nullString) {
1614+
if ($value[0] === Type::T_NULL || $value === static::$nullString) {
16151615
break;
16161616
}
16171617
}
@@ -1637,7 +1637,7 @@ protected function compileChild($child, OutputBlock $out)
16371637
case Type::T_FUNCTION:
16381638
list(, $block) = $child;
16391639

1640-
$this->set(self::$namespaces[$block->type] . $block->name, $block);
1640+
$this->set(static::$namespaces[$block->type] . $block->name, $block);
16411641
break;
16421642

16431643
case Type::T_EXTEND:
@@ -1685,7 +1685,7 @@ protected function compileChild($child, OutputBlock $out)
16851685
list(,, $values) = $this->coerceList($item);
16861686

16871687
foreach ($each->vars as $i => $var) {
1688-
$this->set($var, isset($values[$i]) ? $values[$i] : self::$null, true);
1688+
$this->set($var, isset($values[$i]) ? $values[$i] : static::$null, true);
16891689
}
16901690
}
16911691

@@ -1794,7 +1794,7 @@ protected function compileChild($child, OutputBlock $out)
17941794
// including a mixin
17951795
list(, $name, $argValues, $content) = $child;
17961796

1797-
$mixin = $this->get(self::$namespaces['mixin'] . $name, false);
1797+
$mixin = $this->get(static::$namespaces['mixin'] . $name, false);
17981798

17991799
if (! $mixin) {
18001800
$this->throwError("Undefined mixin $name");
@@ -1813,7 +1813,7 @@ protected function compileChild($child, OutputBlock $out)
18131813
if (isset($content)) {
18141814
$content->scope = $callingScope;
18151815

1816-
$this->setRaw(self::$namespaces['special'] . 'content', $content, $this->env);
1816+
$this->setRaw(static::$namespaces['special'] . 'content', $content, $this->env);
18171817
}
18181818

18191819
if (isset($mixin->args)) {
@@ -1830,8 +1830,8 @@ protected function compileChild($child, OutputBlock $out)
18301830
break;
18311831

18321832
case Type::T_MIXIN_CONTENT:
1833-
$content = $this->get(self::$namespaces['special'] . 'content', false, $this->getStoreEnv())
1834-
?: $this->get(self::$namespaces['special'] . 'content', false, $this->env);
1833+
$content = $this->get(static::$namespaces['special'] . 'content', false, $this->getStoreEnv())
1834+
?: $this->get(static::$namespaces['special'] . 'content', false, $this->env);
18351835

18361836
if (! $content) {
18371837
$content = new \stdClass();
@@ -1918,7 +1918,7 @@ protected function expToString($exp)
19181918
*/
19191919
protected function isTruthy($value)
19201920
{
1921-
return $value !== self::$false && $value !== self::$null;
1921+
return $value !== static::$false && $value !== static::$null;
19221922
}
19231923

19241924
/**
@@ -1973,7 +1973,7 @@ protected function reduce($value, $inExp = false)
19731973
case Type::T_EXPRESSION:
19741974
list(, $op, $left, $right, $inParens) = $value;
19751975

1976-
$opName = isset(self::$operatorNames[$op]) ? self::$operatorNames[$op] : $op;
1976+
$opName = isset(static::$operatorNames[$op]) ? static::$operatorNames[$op] : $op;
19771977
$inExp = $inExp || $this->shouldEval($left) || $this->shouldEval($right);
19781978

19791979
$left = $this->reduce($left, true);
@@ -2089,11 +2089,11 @@ protected function reduce($value, $inExp = false)
20892089

20902090
if ($op === 'not') {
20912091
if ($inExp || $inParens) {
2092-
if ($exp === self::$false || $exp === self::$null) {
2093-
return self::$true;
2092+
if ($exp === static::$false || $exp === static::$null) {
2093+
return static::$true;
20942094
}
20952095

2096-
return self::$false;
2096+
return static::$false;
20972097
}
20982098

20992099
$op = $op . ' ';
@@ -2347,7 +2347,7 @@ protected function opAnd($left, $right, $shouldEval)
23472347
return;
23482348
}
23492349

2350-
if ($left !== self::$false and $left !== self::$null) {
2350+
if ($left !== static::$false and $left !== static::$null) {
23512351
return $this->reduce($right, true);
23522352
}
23532353

@@ -2369,7 +2369,7 @@ protected function opOr($left, $right, $shouldEval)
23692369
return;
23702370
}
23712371

2372-
if ($left !== self::$false and $left !== self::$null) {
2372+
if ($left !== static::$false and $left !== static::$null) {
23732373
return $left;
23742374
}
23752375

@@ -2600,7 +2600,7 @@ protected function opCmpNumberNumber($left, $right)
26002600
*/
26012601
public function toBool($thing)
26022602
{
2603-
return $thing ? self::$true : self::$false;
2603+
return $thing ? static::$true : static::$false;
26042604
}
26052605

26062606
/**
@@ -2883,7 +2883,7 @@ protected function joinSelectors($parent, $child)
28832883
$newPart = [];
28842884

28852885
foreach ($part as $p) {
2886-
if ($p === self::$selfSelector) {
2886+
if ($p === static::$selfSelector) {
28872887
$setSelf = true;
28882888

28892889
foreach ($parent as $i => $parentPart) {
@@ -3102,7 +3102,7 @@ protected function setRaw($name, $value, Environment $env)
31023102
public function get($name, $shouldThrow = true, Environment $env = null)
31033103
{
31043104
$normalizedName = $this->normalizeName($name);
3105-
$specialContentKey = self::$namespaces['special'] . 'content';
3105+
$specialContentKey = static::$namespaces['special'] . 'content';
31063106

31073107
if (! isset($env)) {
31083108
$env = $this->getStoreEnv();
@@ -3510,7 +3510,7 @@ protected function fileExists($name)
35103510
*/
35113511
protected function callScssFunction($name, $argValues, &$returnValue)
35123512
{
3513-
$func = $this->get(self::$namespaces['function'] . $name, false);
3513+
$func = $this->get(static::$namespaces['function'] . $name, false);
35143514

35153515
if (! $func) {
35163516
return false;
@@ -3539,7 +3539,7 @@ protected function callScssFunction($name, $argValues, &$returnValue)
35393539

35403540
$this->popEnv();
35413541

3542-
$returnValue = ! isset($ret) ? self::$defaultValue : $ret;
3542+
$returnValue = ! isset($ret) ? static::$defaultValue : $ret;
35433543

35443544
return true;
35453545
}
@@ -3563,7 +3563,7 @@ protected function callNativeFunction($name, $args, &$returnValue)
35633563
list($f, $prototype) = $this->userFunctions[$name];
35643564
} elseif (($f = $this->getBuiltinFunction($name)) && is_callable($f)) {
35653565
$libName = $f[1];
3566-
$prototype = isset(self::$$libName) ? self::$$libName : null;
3566+
$prototype = isset(static::$$libName) ? static::$$libName : null;
35673567
} else {
35683568
return false;
35693569
}
@@ -3788,15 +3788,15 @@ private function coerceValue($value)
37883788
}
37893789

37903790
if ($value === null) {
3791-
return self::$null;
3791+
return static::$null;
37923792
}
37933793

37943794
if (is_numeric($value)) {
37953795
return new Node\Number($value, '');
37963796
}
37973797

37983798
if ($value === '') {
3799-
return self::$emptyString;
3799+
return static::$emptyString;
38003800
}
38013801

38023802
if (preg_match('/^(#([0-9a-f]{6})|#([0-9a-f]{3}))$/i', $value, $m)) {
@@ -3838,11 +3838,11 @@ protected function coerceMap($item)
38383838
return $item;
38393839
}
38403840

3841-
if ($item === self::$emptyList) {
3842-
return self::$emptyMap;
3841+
if ($item === static::$emptyList) {
3842+
return static::$emptyMap;
38433843
}
38443844

3845-
return [Type::T_MAP, [$item], [self::$null]];
3845+
return [Type::T_MAP, [$item], [static::$null]];
38463846
}
38473847

38483848
/**
@@ -4212,7 +4212,7 @@ protected function libIndex($args)
42124212
list($list, $value) = $args;
42134213

42144214
if ($value[0] === Type::T_MAP) {
4215-
return self::$null;
4215+
return static::$null;
42164216
}
42174217

42184218
if ($list[0] === Type::T_MAP ||
@@ -4224,7 +4224,7 @@ protected function libIndex($args)
42244224
}
42254225

42264226
if ($list[0] !== Type::T_LIST) {
4227-
return self::$null;
4227+
return static::$null;
42284228
}
42294229

42304230
$values = [];
@@ -4235,7 +4235,7 @@ protected function libIndex($args)
42354235

42364236
$key = array_search($this->normalizeValue($value), $values);
42374237

4238-
return false === $key ? self::$null : $key + 1;
4238+
return false === $key ? static::$null : $key + 1;
42394239
}
42404240

42414241
protected static $libRgb = ['red', 'green', 'blue'];
@@ -4805,7 +4805,7 @@ protected function libNth($args)
48054805
$n += count($list[2]);
48064806
}
48074807

4808-
return isset($list[2][$n]) ? $list[2][$n] : self::$defaultValue;
4808+
return isset($list[2][$n]) ? $list[2][$n] : static::$defaultValue;
48094809
}
48104810

48114811
protected static $libSetNth = ['list', 'n', 'value'];
@@ -4843,7 +4843,7 @@ protected function libMapGet($args)
48434843
}
48444844
}
48454845

4846-
return self::$null;
4846+
return static::$null;
48474847
}
48484848

48494849
protected static $libMapKeys = ['map'];
@@ -4994,7 +4994,7 @@ protected function libTypeOf($args)
49944994

49954995
switch ($value[0]) {
49964996
case Type::T_KEYWORD:
4997-
if ($value === self::$true || $value === self::$false) {
4997+
if ($value === static::$true || $value === static::$false) {
49984998
return 'bool';
49994999
}
50005000

@@ -5067,7 +5067,7 @@ protected function libStrIndex($args)
50675067

50685068
$result = strpos($stringContent, $substringContent);
50695069

5070-
return $result === false ? self::$null : new Node\Number($result + 1, '');
5070+
return $result === false ? static::$null : new Node\Number($result + 1, '');
50715071
}
50725072

50735073
protected static $libStrInsert = ['string', 'insert', 'index'];
@@ -5099,7 +5099,7 @@ protected function libStrLength($args)
50995099
protected function libStrSlice($args)
51005100
{
51015101
if (isset($args[2]) && $args[2][1] == 0) {
5102-
return self::$nullString;
5102+
return static::$nullString;
51035103
}
51045104

51055105
$string = $this->coerceString($args[0]);
@@ -5161,7 +5161,7 @@ protected function libFunctionExists($args)
51615161
$name = $this->compileStringContent($string);
51625162

51635163
// user defined functions
5164-
if ($this->has(self::$namespaces['function'] . $name)) {
5164+
if ($this->has(static::$namespaces['function'] . $name)) {
51655165
return true;
51665166
}
51675167

@@ -5192,7 +5192,7 @@ protected function libMixinExists($args)
51925192
$string = $this->coerceString($args[0]);
51935193
$name = $this->compileStringContent($string);
51945194

5195-
return $this->has(self::$namespaces['mixin'] . $name);
5195+
return $this->has(static::$namespaces['mixin'] . $name);
51965196
}
51975197

51985198
protected static $libVariableExists = ['name'];
@@ -5250,7 +5250,7 @@ protected function libUniqueId()
52505250
protected static $libInspect = ['value'];
52515251
protected function libInspect($args)
52525252
{
5253-
if ($args[0] === self::$null) {
5253+
if ($args[0] === static::$null) {
52545254
return [Type::T_KEYWORD, 'null'];
52555255
}
52565256

0 commit comments

Comments
 (0)