Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Please also have a look at our
(#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958,
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145,
#1162, #1163, #1166, #1172, #1174, #1178, #1179, #1181, #1183, #1184, #1186,
#1187)
#1187, #1190)
- Add visibility to all class/interface constants (#469)

### Deprecated
Expand Down
12 changes: 0 additions & 12 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ parameters:
count: 1
path: ../src/Rule/Rule.php

-
message: '#^Parameters should have "bool" types as the only types passed to this method$#'
identifier: typePerfect.narrowPublicClassMethodParamType
count: 1
path: ../src/Rule/Rule.php

-
message: '#^Parameters should have "int\|int" types as the only types passed to this method$#'
identifier: typePerfect.narrowPublicClassMethodParamType
count: 1
path: ../src/Rule/Rule.php

-
message: '#^Only booleans are allowed in an if condition, string given\.$#'
identifier: if.condNotBoolean
Expand Down
2 changes: 2 additions & 0 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public function setPosition(int $position): void
}

/**
* @return non-empty-string
*
* @throws UnexpectedTokenException
*/
public function parseIdentifier(bool $ignoreCase = true): string
Expand Down
46 changes: 21 additions & 25 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class Rule implements Renderable, Commentable
{
/**
* @var string
* @var non-empty-string
*/
private $rule;

Expand All @@ -42,7 +42,7 @@ class Rule implements Renderable, Commentable
protected $lineNumber;

/**
* @var int
* @var int<0, max>
*
* @internal since 8.8.0
*/
Expand All @@ -56,11 +56,11 @@ class Rule implements Renderable, Commentable
protected $comments = [];

/**
* @param string $rule
* @param non-empty-string $rule
* @param int<0, max> $lineNumber
* @param int $columnNumber
* @param int<0, max> $columnNumber
*/
public function __construct($rule, int $lineNumber = 0, $columnNumber = 0)
public function __construct(string $rule, int $lineNumber = 0, int $columnNumber = 0)
{
$this->rule = $rule;
$this->lineNumber = $lineNumber;
Expand Down Expand Up @@ -108,11 +108,11 @@ public static function parse(ParserState $parserState, array $commentsBeforeRule
* The first item is the innermost separator (or, put another way, the highest-precedence operator).
* The sequence continues to the outermost separator (or lowest-precedence operator).
*
* @param string $rule
* @param non-empty-string $rule
*
* @return list<non-empty-string>
*/
private static function listDelimiterForRule($rule): array
private static function listDelimiterForRule(string $rule): array
{
if (\preg_match('/^font($|-)/', $rule)) {
return [',', '/', ' '];
Expand All @@ -135,35 +135,35 @@ public function getLineNo(): int
}

/**
* @return int
* @return int<0, max>
*/
public function getColNo()
public function getColNo(): int
{
return $this->columnNumber;
}

/**
* @param int<0, max> $lineNumber
* @param int $columnNumber
* @param int<0, max> $columnNumber
*/
public function setPosition(int $lineNumber, $columnNumber): void
public function setPosition(int $lineNumber, int $columnNumber): void
{
$this->columnNumber = $columnNumber;
$this->lineNumber = $lineNumber;
}

/**
* @param string $rule
* @param non-empty-string $rule
*/
public function setRule($rule): void
public function setRule(string $rule): void
{
$this->rule = $rule;
}

/**
* @return string
* @return non-empty-string
*/
public function getRule()
public function getRule(): string
{
return $this->rule;
}
Expand All @@ -189,9 +189,8 @@ public function setValue($value): void
* Otherwise, the existing value will be wrapped by one.
*
* @param RuleValueList|array<int, RuleValueList> $value
* @param string $type
*/
public function addValue($value, $type = ' '): void
public function addValue($value, string $type = ' '): void
{
if (!\is_array($value)) {
$value = [$value];
Expand All @@ -208,22 +207,19 @@ public function addValue($value, $type = ' '): void
}
}

/**
* @param bool $isImportant
*/
public function setIsImportant($isImportant): void
public function setIsImportant(bool $isImportant): void
{
$this->isImportant = $isImportant;
}

/**
* @return bool
*/
public function getIsImportant()
public function getIsImportant(): bool
{
return $this->isImportant;
}

/**
* @return non-empty-string
*/
public function render(OutputFormat $outputFormat): string
{
$formatter = $outputFormat->getFormatter();
Expand Down