@@ -139,8 +139,8 @@ |
||
139 | 139 | |
140 | 140 | /** |
141 | 141 | * @param double $v |
142 | - * @param double $max |
|
143 | - * @param double $min |
|
142 | + * @param integer $max |
|
143 | + * @param integer $min |
|
144 | 144 | * |
145 | 145 | * @return mixed |
146 | 146 | */ |
@@ -118,8 +118,7 @@ |
||
118 | 118 | $r = $g = $b = $L; |
119 | 119 | } else { |
120 | 120 | $temp2 = $L < 0.5 ? |
121 | - $L * (1.0 + $S) : |
|
122 | - $L + $S - $L * $S; |
|
121 | + $L * (1.0 + $S) : $L + $S - $L * $S; |
|
123 | 122 | |
124 | 123 | $temp1 = 2.0 * $L - $temp2; |
125 | 124 |
@@ -132,6 +132,10 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // attempts to find the path of an import url, returns null for css files |
135 | + |
|
136 | + /** |
|
137 | + * @param string $url |
|
138 | + */ |
|
135 | 139 | protected function findImport($url) |
136 | 140 | { |
137 | 141 | foreach ((array)$this->importDir as $dir) { |
@@ -144,6 +148,9 @@ discard block |
||
144 | 148 | return null; |
145 | 149 | } |
146 | 150 | |
151 | + /** |
|
152 | + * @param string $name |
|
153 | + */ |
|
147 | 154 | protected function fileExists($name) |
148 | 155 | { |
149 | 156 | return is_file($name); |
@@ -347,6 +354,9 @@ discard block |
||
347 | 354 | return $scope; |
348 | 355 | } |
349 | 356 | |
357 | + /** |
|
358 | + * @param string[] $selectors |
|
359 | + */ |
|
350 | 360 | protected function compileNestedBlock($block, $selectors) |
351 | 361 | { |
352 | 362 | $this->pushEnv($this->env, $block); |
@@ -367,6 +377,9 @@ discard block |
||
367 | 377 | $this->popEnv(); |
368 | 378 | } |
369 | 379 | |
380 | + /** |
|
381 | + * @param \stdClass $out |
|
382 | + */ |
|
370 | 383 | protected function compileProps($block, $out) |
371 | 384 | { |
372 | 385 | foreach ($this->sortProps($block->props) as $prop) { |
@@ -1298,6 +1311,9 @@ discard block |
||
1298 | 1311 | return $value; |
1299 | 1312 | } |
1300 | 1313 | |
1314 | + /** |
|
1315 | + * @param boolean $a |
|
1316 | + */ |
|
1301 | 1317 | public function toBool($a) |
1302 | 1318 | { |
1303 | 1319 | if ($a) { |
@@ -1514,6 +1530,10 @@ discard block |
||
1514 | 1530 | } |
1515 | 1531 | |
1516 | 1532 | // the state of execution |
1533 | + |
|
1534 | + /** |
|
1535 | + * @param NodeEnv $parent |
|
1536 | + */ |
|
1517 | 1537 | protected function pushEnv($parent, $block = null) |
1518 | 1538 | { |
1519 | 1539 | $e = new \LesserPhp\NodeEnv(); |
@@ -1825,6 +1845,9 @@ discard block |
||
1825 | 1845 | return $out; |
1826 | 1846 | } |
1827 | 1847 | |
1848 | + /** |
|
1849 | + * @param string|null $name |
|
1850 | + */ |
|
1828 | 1851 | protected function makeParser($name) |
1829 | 1852 | { |
1830 | 1853 | $parser = new \LesserPhp\Parser($this, $name); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | // attempts to find the path of an import url, returns null for css files |
135 | 135 | protected function findImport($url) |
136 | 136 | { |
137 | - foreach ((array)$this->importDir as $dir) { |
|
137 | + foreach ((array) $this->importDir as $dir) { |
|
138 | 138 | $full = $dir . (substr($dir, -1) !== '/' ? '/' : '') . $url; |
139 | 139 | if ($this->fileExists($file = $full . '.less') || $this->fileExists($file = $full)) { |
140 | 140 | return $file; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $oldImport = $this->importDir; |
237 | 237 | |
238 | 238 | // TODO: this is because the importDir api is stupid |
239 | - $this->importDir = (array)$this->importDir; |
|
239 | + $this->importDir = (array) $this->importDir; |
|
240 | 240 | array_unshift($this->importDir, $importDir); |
241 | 241 | |
242 | 242 | foreach ($props as $prop) { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | |
832 | 832 | $orderedArgs = []; |
833 | 833 | $keywordArgs = []; |
834 | - foreach ((array)$args as $arg) { |
|
834 | + foreach ((array) $args as $arg) { |
|
835 | 835 | switch ($arg[0]) { |
836 | 836 | case "arg": |
837 | 837 | if (!isset($arg[2])) { |
@@ -928,8 +928,7 @@ discard block |
||
928 | 928 | $result = $this->tryImport($importPath, $block, $out); |
929 | 929 | |
930 | 930 | $this->env->addImports($importId, $result === false ? |
931 | - [false, "@import " . $this->compileValue($importPath) . ";"] : |
|
932 | - $result); |
|
931 | + [false, "@import " . $this->compileValue($importPath) . ";"] : $result); |
|
933 | 932 | |
934 | 933 | break; |
935 | 934 | case "import_mixin": |
@@ -1051,7 +1050,7 @@ discard block |
||
1051 | 1050 | } |
1052 | 1051 | list($color, $delta) = $args[2]; |
1053 | 1052 | $color = $this->assertions->assertColor($color); |
1054 | - $delta = (float)$delta[1]; |
|
1053 | + $delta = (float) $delta[1]; |
|
1055 | 1054 | |
1056 | 1055 | return [$color, $delta]; |
1057 | 1056 | } |
@@ -1078,7 +1077,7 @@ discard block |
||
1078 | 1077 | $i = 0; |
1079 | 1078 | foreach ($rawComponents as $c) { |
1080 | 1079 | $val = $this->reduce($c); |
1081 | - $val = isset($val[1]) ? (float)$val[1] : 0; |
|
1080 | + $val = isset($val[1]) ? (float) $val[1] : 0; |
|
1082 | 1081 | |
1083 | 1082 | if ($i === 0) { |
1084 | 1083 | $clamp = 360; |
@@ -1107,13 +1106,13 @@ discard block |
||
1107 | 1106 | if ($c[0] === "number" && $c[2] === "%") { |
1108 | 1107 | $components[] = 255 * ($c[1] / 100); |
1109 | 1108 | } else { |
1110 | - $components[] = (float)$c[1]; |
|
1109 | + $components[] = (float) $c[1]; |
|
1111 | 1110 | } |
1112 | 1111 | } elseif ($i === 4) { |
1113 | 1112 | if ($c[0] === "number" && $c[2] === "%") { |
1114 | 1113 | $components[] = 1.0 * ($c[1] / 100); |
1115 | 1114 | } else { |
1116 | - $components[] = (float)$c[1]; |
|
1115 | + $components[] = (float) $c[1]; |
|
1117 | 1116 | } |
1118 | 1117 | } else { |
1119 | 1118 | break; |
@@ -1162,7 +1161,7 @@ discard block |
||
1162 | 1161 | $key = $this->vPrefix . $this->compileValue($this->functions->e($key)); |
1163 | 1162 | } |
1164 | 1163 | |
1165 | - $seen =& $this->env->seenNames; |
|
1164 | + $seen = & $this->env->seenNames; |
|
1166 | 1165 | |
1167 | 1166 | if (!empty($seen[$key])) { |
1168 | 1167 | $this->throwError("infinite loop detected: $key"); |
@@ -1609,7 +1608,7 @@ discard block |
||
1609 | 1608 | $name = '@' . $name; |
1610 | 1609 | } |
1611 | 1610 | $parser->count = 0; |
1612 | - $parser->buffer = (string)$strValue; |
|
1611 | + $parser->buffer = (string) $strValue; |
|
1613 | 1612 | if (!$parser->propertyValue($value)) { |
1614 | 1613 | throw new GeneralException("failed to parse passed in variable $name: $strValue"); |
1615 | 1614 | } |
@@ -1663,7 +1662,7 @@ discard block |
||
1663 | 1662 | |
1664 | 1663 | $oldImport = $this->importDir; |
1665 | 1664 | |
1666 | - $this->importDir = (array)$this->importDir; |
|
1665 | + $this->importDir = (array) $this->importDir; |
|
1667 | 1666 | $this->importDir[] = $pi['dirname'] . '/'; |
1668 | 1667 | |
1669 | 1668 | $this->addParsedFile($fname); |
@@ -1883,12 +1882,12 @@ discard block |
||
1883 | 1882 | |
1884 | 1883 | public function setImportDir($dirs) |
1885 | 1884 | { |
1886 | - $this->importDir = (array)$dirs; |
|
1885 | + $this->importDir = (array) $dirs; |
|
1887 | 1886 | } |
1888 | 1887 | |
1889 | 1888 | public function addImportDir($dir) |
1890 | 1889 | { |
1891 | - $this->importDir = (array)$this->importDir; |
|
1890 | + $this->importDir = (array) $this->importDir; |
|
1892 | 1891 | $this->importDir[] = $dir; |
1893 | 1892 | } |
1894 | 1893 |
@@ -740,7 +740,7 @@ |
||
740 | 740 | */ |
741 | 741 | public function findImport($url) |
742 | 742 | { |
743 | - foreach ((array)$this->compiler->importDir as $dir) { |
|
743 | + foreach ((array) $this->compiler->importDir as $dir) { |
|
744 | 744 | $full = $dir . (substr($dir, -1) !== '/' ? '/' : '') . $url; |
745 | 745 | if ($this->fileExists($file = $full . '.less') || $this->fileExists($file = $full)) { |
746 | 746 | return $file; |