Skip to content

Commit db4d18b

Browse files
committed
Merge branch 'upstream_master' into fix/expression-parsing
2 parents d9f89cc + cc791ad commit db4d18b

7 files changed

Lines changed: 47 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ jobs:
5353
uses: shivammathur/setup-php@v2
5454
with:
5555
php-version: ${{ matrix.php-version }}
56+
ini-values: error_reporting=E_ALL
5657
tools: composer:v2
5758
coverage: "${{ matrix.coverage }}"
5859

60+
- name: Show the Composer configuration
61+
run: composer config --global --list
62+
5963
- name: Cache dependencies installed with composer
6064
uses: actions/cache@v3
6165
with:
@@ -108,6 +112,9 @@ jobs:
108112
tools: "composer:v2, phive"
109113
coverage: none
110114

115+
- name: Show the Composer configuration
116+
run: composer config --global --list
117+
111118
- name: Cache dependencies installed with composer
112119
uses: actions/cache@v3
113120
with:

.phive/phars.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.9.4" installed="3.9.4" location="./.phive/php-cs-fixer.phar" copy="false"/>
3+
<phar name="php-cs-fixer" version="^3.13.2" installed="3.13.2" location="./.phive/php-cs-fixer.phar" copy="false"/>
44
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./.phive/phpcbf.phar" copy="false"/>
55
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./.phive/phpcs.phar" copy="false"/>
6-
<phar name="phpstan" version="^1.8.1" installed="1.8.1" location="./.phive/phpstan.phar" copy="false"/>
6+
<phar name="phpstan" version="^1.9.14" installed="1.9.14" location="./.phive/phpstan.phar" copy="false"/>
77
</phive>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ $cssDocument = $parser->parse();
157157
foreach($cssDocument->getAllRuleSets() as $oRuleSet) {
158158
// Note that the added dash will make this remove all rules starting with
159159
// `font-` (like `font-size`, `font-weight`, etc.) as well as a potential
160-
// `font-rule`.
160+
// `font` rule.
161161
$oRuleSet->removeRule('font-');
162162
$oRuleSet->removeRule('cursor');
163163
}

src/Property/Import.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,12 @@ public function setComments(array $aComments)
134134
{
135135
$this->aComments = $aComments;
136136
}
137+
138+
/**
139+
* @return string
140+
*/
141+
public function getMediaQuery()
142+
{
143+
return $this->sMediaQuery;
144+
}
137145
}

src/Value/Size.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,16 @@ public static function parse(ParserState $oParserState, $bIsColorComponent = fal
7777
if ($oParserState->comes('-')) {
7878
$sSize .= $oParserState->consume('-');
7979
}
80-
while (is_numeric($oParserState->peek()) || $oParserState->comes('.')) {
80+
while (is_numeric($oParserState->peek()) || $oParserState->comes('.') || $oParserState->comes('e', true)) {
8181
if ($oParserState->comes('.')) {
8282
$sSize .= $oParserState->consume('.');
83+
} elseif ($oParserState->comes('e', true)) {
84+
$sLookahead = $oParserState->peek(1, 1);
85+
if (is_numeric($sLookahead) || $sLookahead === '+' || $sLookahead === '-') {
86+
$sSize .= $oParserState->consume(2);
87+
} else {
88+
break; // Reached the unit part of the number like "em" or "ex"
89+
}
8390
} else {
8491
$sSize .= $oParserState->consume(1);
8592
}

tests/ParserTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,21 @@ public function largeSizeValuesInFile()
12291229
self::assertSame($sExpected, $oDoc->render());
12301230
}
12311231

1232+
/**
1233+
* @test
1234+
*/
1235+
public function scientificNotationSizeValuesInFile()
1236+
{
1237+
$oDoc = $this->parsedStructureForFile(
1238+
'scientific-notation-numbers',
1239+
Settings::create()->withMultibyteSupport(false)
1240+
);
1241+
$sExpected = ''
1242+
. 'body {background-color: rgba(62,174,151,3041820656523200167936);'
1243+
. 'z-index: .030418206565232;font-size: 1em;top: 192.3478px;}';
1244+
self::assertSame($sExpected, $oDoc->render());
1245+
}
1246+
12321247
/**
12331248
* @test
12341249
*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
body {
2+
background-color: rgba(62,174,151,3.0418206565232E+21);
3+
z-index: 3.0418206565232E-2;
4+
font-size: 1em;
5+
top: 1.923478e2px;
6+
}

0 commit comments

Comments
 (0)