Skip to content

Commit a47b00e

Browse files
committed
[TASK] Remove the IE hack in Rule
1 parent e1f8bd3 commit a47b00e

File tree

5 files changed

+2
-76
lines changed

5 files changed

+2
-76
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Please also have a look at our
3737

3838
### Removed
3939

40+
- Remove the IE hack in `Rule` (#995))
4041
- Remove `OutputFormat::level()` (#874)
4142
- Remove expansion of shorthand properties (#838)
4243
- Remove `Parser::setCharset/getCharset` (#808)

config/phpstan-baseline.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ parameters:
240240
count: 1
241241
path: ../src/Rule/Rule.php
242242

243-
-
244-
message: '#^Construct empty\(\) is not allowed\. Use more strict comparison\.$#'
245-
identifier: empty.notAllowed
246-
count: 1
247-
path: ../src/Rule/Rule.php
248-
249243
-
250244
message: '#^Only booleans are allowed in an if condition, Sabberworm\\CSS\\Value\\RuleValueList\|string\|null given\.$#'
251245
identifier: if.condNotBoolean
@@ -264,12 +258,6 @@ parameters:
264258
count: 1
265259
path: ../src/Rule/Rule.php
266260

267-
-
268-
message: '#^Parameters should have "string" types as the only types passed to this method$#'
269-
identifier: typePerfect.narrowPublicClassMethodParamType
270-
count: 1
271-
path: ../src/Rule/Rule.php
272-
273261
-
274262
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:comments\(\)\.$#'
275263
identifier: method.notFound

src/Rule/Rule.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ class Rule implements Renderable, Commentable
3636
*/
3737
private $isImportant = false;
3838

39-
/**
40-
* @var array<int, int>
41-
*/
42-
private $ieHack = [];
43-
4439
/**
4540
* @var int
4641
*/
@@ -94,7 +89,7 @@ public static function parse(ParserState $parserState): Rule
9489
if ($parserState->getSettings()->lenientParsing) {
9590
while ($parserState->comes('\\')) {
9691
$parserState->consume('\\');
97-
$rule->addIeHack($parserState->consume());
92+
$parserState->consume();
9893
$parserState->consumeWhiteSpace();
9994
}
10095
}
@@ -220,30 +215,6 @@ public function addValue($value, $type = ' '): void
220215
}
221216
}
222217

223-
/**
224-
* @param int $modifier
225-
*/
226-
public function addIeHack($modifier): void
227-
{
228-
$this->ieHack[] = $modifier;
229-
}
230-
231-
/**
232-
* @param array<int, int> $modifiers
233-
*/
234-
public function setIeHack(array $modifiers): void
235-
{
236-
$this->ieHack = $modifiers;
237-
}
238-
239-
/**
240-
* @return array<int, int>
241-
*/
242-
public function getIeHack()
243-
{
244-
return $this->ieHack;
245-
}
246-
247218
/**
248219
* @param bool $isImportant
249220
*/
@@ -276,9 +247,6 @@ public function render(OutputFormat $outputFormat): string
276247
} else {
277248
$result .= $this->value;
278249
}
279-
if (!empty($this->ieHack)) {
280-
$result .= ' \\' . \implode('\\', $this->ieHack);
281-
}
282250
if ($this->isImportant) {
283251
$result .= ' !important';
284252
}

tests/ParserTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,28 +1060,6 @@ public function unexpectedTokenExceptionLineNo(): void
10601060
}
10611061
}
10621062

1063-
/**
1064-
* @test
1065-
*/
1066-
public function ieHacksStrictParsing(): void
1067-
{
1068-
$this->expectException(UnexpectedTokenException::class);
1069-
1070-
// We can't strictly parse IE hacks.
1071-
self::parsedStructureForFile('ie-hacks', Settings::create()->beStrict());
1072-
}
1073-
1074-
/**
1075-
* @test
1076-
*/
1077-
public function ieHacksParsing(): void
1078-
{
1079-
$document = self::parsedStructureForFile('ie-hacks', Settings::create()->withLenientParsing(true));
1080-
$expected = 'p {padding-right: .75rem \\9;background-image: none \\9;color: red \\9\\0;'
1081-
. 'background-color: red \\9\\0;background-color: red \\9\\0 !important;content: "red \\0";content: "red઼";}';
1082-
self::assertSame($expected, $document->render());
1083-
}
1084-
10851063
/**
10861064
* @depends files
10871065
*

tests/fixtures/ie-hacks.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)