Skip to content
This repository was archived by the owner on Nov 27, 2021. It is now read-only.

Commit 1312ecf

Browse files
authored
Merge pull request chapter-three#16 from m4olivei/14-zero-should-be-supported-unit
Issue chapter-three#14 support an integer value of 0 as a supported unit.
2 parents 78cea83 + 3282ddf commit 1312ecf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Document/Base.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected static function isSupportedUnit($value) {
103103
'cw',
104104
'pt',
105105
);
106-
$re = '/^[1-9][0-9]*(' . implode('|', $units) . ')?$/';
106+
$re = '/^(0|[1-9][0-9]*)(' . implode('|', $units) . ')?$/';
107107
return preg_match($re, $value);
108108
}
109109

tests/Document/BaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testSetters() {
110110
}
111111
foreach (array(
112112
// Integers.
113-
1, 10, 515,
113+
0, 1, 10, 515,
114114
// With unit.
115115
'1vh', '10vw', '515vmin', '1vmax', '1gut', '1cw', '1pt',
116116
) as $value

0 commit comments

Comments
 (0)