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

Commit

Permalink
Merge pull request chapter-three#16 from m4olivei/14-zero-should-be-s…
Browse files Browse the repository at this point in the history
…upported-unit

Issue chapter-three#14 support an integer value of 0 as a supported unit.
  • Loading branch information
minnur authored Feb 14, 2017
2 parents 78cea83 + 3282ddf commit 1312ecf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Document/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected static function isSupportedUnit($value) {
'cw',
'pt',
);
$re = '/^[1-9][0-9]*(' . implode('|', $units) . ')?$/';
$re = '/^(0|[1-9][0-9]*)(' . implode('|', $units) . ')?$/';
return preg_match($re, $value);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Document/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testSetters() {
}
foreach (array(
// Integers.
1, 10, 515,
0, 1, 10, 515,
// With unit.
'1vh', '10vw', '515vmin', '1vmax', '1gut', '1cw', '1pt',
) as $value
Expand Down

0 comments on commit 1312ecf

Please sign in to comment.