@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * attempts to find the path of an import url, returns null for css files |
| 183 | 183 | * |
| 184 | - * @param $url |
|
| 184 | + * @param string $url |
|
| 185 | 185 | * |
| 186 | 186 | * @return null|string |
| 187 | 187 | */ |
@@ -197,6 +197,9 @@ discard block |
||
| 197 | 197 | return null; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | + /** |
|
| 201 | + * @param string $name |
|
| 202 | + */ |
|
| 200 | 203 | protected function fileExists($name) |
| 201 | 204 | { |
| 202 | 205 | return is_file($name); |
@@ -398,6 +401,9 @@ discard block |
||
| 398 | 401 | return $scope; |
| 399 | 402 | } |
| 400 | 403 | |
| 404 | + /** |
|
| 405 | + * @param string[] $selectors |
|
| 406 | + */ |
|
| 401 | 407 | protected function compileNestedBlock($block, $selectors) |
| 402 | 408 | { |
| 403 | 409 | $this->pushEnv($this->env, $block); |
@@ -418,6 +424,9 @@ discard block |
||
| 418 | 424 | $this->popEnv(); |
| 419 | 425 | } |
| 420 | 426 | |
| 427 | + /** |
|
| 428 | + * @param \stdClass $out |
|
| 429 | + */ |
|
| 421 | 430 | protected function compileProps($block, $out) |
| 422 | 431 | { |
| 423 | 432 | foreach ($this->sortProps($block->props) as $prop) { |
@@ -1349,6 +1358,9 @@ discard block |
||
| 1349 | 1358 | return $value; |
| 1350 | 1359 | } |
| 1351 | 1360 | |
| 1361 | + /** |
|
| 1362 | + * @param boolean $a |
|
| 1363 | + */ |
|
| 1352 | 1364 | public function toBool($a) |
| 1353 | 1365 | { |
| 1354 | 1366 | if ($a) { |
@@ -1565,6 +1577,10 @@ discard block |
||
| 1565 | 1577 | } |
| 1566 | 1578 | |
| 1567 | 1579 | // the state of execution |
| 1580 | + |
|
| 1581 | + /** |
|
| 1582 | + * @param NodeEnv $parent |
|
| 1583 | + */ |
|
| 1568 | 1584 | protected function pushEnv($parent, $block = null) |
| 1569 | 1585 | { |
| 1570 | 1586 | $e = new \LesserPhp\NodeEnv(); |
@@ -1875,6 +1891,9 @@ discard block |
||
| 1875 | 1891 | return $out; |
| 1876 | 1892 | } |
| 1877 | 1893 | |
| 1894 | + /** |
|
| 1895 | + * @param string|null $name |
|
| 1896 | + */ |
|
| 1878 | 1897 | protected function makeParser($name) |
| 1879 | 1898 | { |
| 1880 | 1899 | $parser = new \LesserPhp\Parser($this, $name); |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | $orderedArgs = []; |
| 884 | 884 | $keywordArgs = []; |
| 885 | - foreach ((array)$args as $arg) { |
|
| 885 | + foreach ((array) $args as $arg) { |
|
| 886 | 886 | switch ($arg[0]) { |
| 887 | 887 | case "arg": |
| 888 | 888 | if (!isset($arg[2])) { |
@@ -979,8 +979,7 @@ discard block |
||
| 979 | 979 | $result = $this->tryImport($importPath, $block, $out); |
| 980 | 980 | |
| 981 | 981 | $this->env->addImports($importId, $result === false ? |
| 982 | - [false, "@import " . $this->compileValue($importPath) . ";"] : |
|
| 983 | - $result); |
|
| 982 | + [false, "@import " . $this->compileValue($importPath) . ";"] : $result); |
|
| 984 | 983 | |
| 985 | 984 | break; |
| 986 | 985 | case "import_mixin": |
@@ -1102,7 +1101,7 @@ discard block |
||
| 1102 | 1101 | } |
| 1103 | 1102 | list($color, $delta) = $args[2]; |
| 1104 | 1103 | $color = $this->assertions->assertColor($color); |
| 1105 | - $delta = (float)$delta[1]; |
|
| 1104 | + $delta = (float) $delta[1]; |
|
| 1106 | 1105 | |
| 1107 | 1106 | return [$color, $delta]; |
| 1108 | 1107 | } |
@@ -1129,7 +1128,7 @@ discard block |
||
| 1129 | 1128 | $i = 0; |
| 1130 | 1129 | foreach ($rawComponents as $c) { |
| 1131 | 1130 | $val = $this->reduce($c); |
| 1132 | - $val = isset($val[1]) ? (float)$val[1] : 0; |
|
| 1131 | + $val = isset($val[1]) ? (float) $val[1] : 0; |
|
| 1133 | 1132 | |
| 1134 | 1133 | if ($i === 0) { |
| 1135 | 1134 | $clamp = 360; |
@@ -1158,13 +1157,13 @@ discard block |
||
| 1158 | 1157 | if ($c[0] === "number" && $c[2] === "%") { |
| 1159 | 1158 | $components[] = 255 * ($c[1] / 100); |
| 1160 | 1159 | } else { |
| 1161 | - $components[] = (float)$c[1]; |
|
| 1160 | + $components[] = (float) $c[1]; |
|
| 1162 | 1161 | } |
| 1163 | 1162 | } elseif ($i === 4) { |
| 1164 | 1163 | if ($c[0] === "number" && $c[2] === "%") { |
| 1165 | 1164 | $components[] = 1.0 * ($c[1] / 100); |
| 1166 | 1165 | } else { |
| 1167 | - $components[] = (float)$c[1]; |
|
| 1166 | + $components[] = (float) $c[1]; |
|
| 1168 | 1167 | } |
| 1169 | 1168 | } else { |
| 1170 | 1169 | break; |
@@ -1213,7 +1212,7 @@ discard block |
||
| 1213 | 1212 | $key = $this->vPrefix . $this->compileValue($this->functions->e($key)); |
| 1214 | 1213 | } |
| 1215 | 1214 | |
| 1216 | - $seen =& $this->env->seenNames; |
|
| 1215 | + $seen = & $this->env->seenNames; |
|
| 1217 | 1216 | |
| 1218 | 1217 | if (!empty($seen[$key])) { |
| 1219 | 1218 | $this->throwError("infinite loop detected: $key"); |
@@ -1660,7 +1659,7 @@ discard block |
||
| 1660 | 1659 | $name = '@' . $name; |
| 1661 | 1660 | } |
| 1662 | 1661 | $parser->count = 0; |
| 1663 | - $parser->buffer = (string)$strValue; |
|
| 1662 | + $parser->buffer = (string) $strValue; |
|
| 1664 | 1663 | if (!$parser->propertyValue($value)) { |
| 1665 | 1664 | throw new GeneralException("failed to parse passed in variable $name: $strValue"); |
| 1666 | 1665 | } |
@@ -114,6 +114,9 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $buffer |
|
| 119 | + */ |
|
| 117 | 120 | public function parse($buffer) |
| 118 | 121 | { |
| 119 | 122 | $this->count = 0; |
@@ -483,6 +486,7 @@ discard block |
||
| 483 | 486 | |
| 484 | 487 | /** |
| 485 | 488 | * recursively parse infix equation with $lhs at precedence $minP |
| 489 | + * @param integer $minP |
|
| 486 | 490 | */ |
| 487 | 491 | protected function expHelper($lhs, $minP) |
| 488 | 492 | { |
@@ -775,6 +779,11 @@ discard block |
||
| 775 | 779 | } |
| 776 | 780 | |
| 777 | 781 | // an unbounded string stopped by $end |
| 782 | + |
|
| 783 | + /** |
|
| 784 | + * @param string $end |
|
| 785 | + * @param string[] $rejectStrs |
|
| 786 | + */ |
|
| 778 | 787 | protected function openString($end, &$out, $nestingOpen = null, $rejectStrs = null) |
| 779 | 788 | { |
| 780 | 789 | $oldWhite = $this->eatWhiteDefault; |
@@ -1429,6 +1438,9 @@ discard block |
||
| 1429 | 1438 | |
| 1430 | 1439 | /* raw parsing functions */ |
| 1431 | 1440 | |
| 1441 | + /** |
|
| 1442 | + * @param boolean $eatWhitespace |
|
| 1443 | + */ |
|
| 1432 | 1444 | protected function literal($what, $eatWhitespace = null) |
| 1433 | 1445 | { |
| 1434 | 1446 | if ($eatWhitespace === null) { |
@@ -1456,6 +1468,9 @@ discard block |
||
| 1456 | 1468 | return $this->match(self::$literalCache[$what], $m, $eatWhitespace); |
| 1457 | 1469 | } |
| 1458 | 1470 | |
| 1471 | + /** |
|
| 1472 | + * @param string $parseItem |
|
| 1473 | + */ |
|
| 1459 | 1474 | protected function genericList(&$out, $parseItem, $delim = "", $flatten = true) |
| 1460 | 1475 | { |
| 1461 | 1476 | $s = $this->seek(); |
@@ -1549,6 +1564,10 @@ discard block |
||
| 1549 | 1564 | } |
| 1550 | 1565 | |
| 1551 | 1566 | // match something without consuming it |
| 1567 | + |
|
| 1568 | + /** |
|
| 1569 | + * @param string $regex |
|
| 1570 | + */ |
|
| 1552 | 1571 | protected function peek($regex, &$out = null, $from = null) |
| 1553 | 1572 | { |
| 1554 | 1573 | if ($from === null) { |
@@ -1572,6 +1591,9 @@ discard block |
||
| 1572 | 1591 | |
| 1573 | 1592 | /* misc functions */ |
| 1574 | 1593 | |
| 1594 | + /** |
|
| 1595 | + * @param integer $count |
|
| 1596 | + */ |
|
| 1575 | 1597 | public function throwError($msg = "parse error", $count = null) |
| 1576 | 1598 | { |
| 1577 | 1599 | $count = $count === null ? $this->count : $count; |
@@ -1621,6 +1643,10 @@ discard block |
||
| 1621 | 1643 | } |
| 1622 | 1644 | |
| 1623 | 1645 | // push a block that doesn't multiply tags |
| 1646 | + |
|
| 1647 | + /** |
|
| 1648 | + * @param string $type |
|
| 1649 | + */ |
|
| 1624 | 1650 | protected function pushSpecialBlock($type) |
| 1625 | 1651 | { |
| 1626 | 1652 | return $this->pushBlock(null, $type); |