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 @@ -19,7 +19,7 @@ Please also have a look at our
- Methods `getLineNumber` and `getColumnNumber` which return a nullable `int`
for the following classes:
`Comment`, `CSSList`, `SourceException`, `Charset`, `CSSNamespace`, `Import`,
`Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1225)
`Rule`, `DeclarationBlock`, `RuleSet`, `CSSFunction`, `Value` (#1225, #1263)
- `Positionable` interface for CSS items that may have a position
(line and perhaps column number) in the parsed CSS (#1221)
- Partial support for CSS Color Module Level 4:
Expand Down
2 changes: 2 additions & 0 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
$last = $rules[$rulesCount - 1];
$ruleToAdd->setPosition($last->getLineNo() + 1, 0);
}
} elseif ($ruleToAdd->getColumnNumber() === null) {
$ruleToAdd->setPosition($ruleToAdd->getLineNumber(), 0);
}

\array_splice($this->rules[$propertyName], $position, 0, [$ruleToAdd]);
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/RuleSet/RuleSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ public function addRuleWithOnlyLineNumberAddsRuleAndSetsColumnNumberPreservingLi
array $initialPropertyNames,
string $propertyNameToAdd
): void {
self::markTestSkipped('currently broken - does not set column number');

$ruleToAdd = new Rule($propertyNameToAdd);
$ruleToAdd->setPosition(42);
$this->setRulesFromPropertyNames($initialPropertyNames);
Expand Down