Skip to content

Commit 37d64cc

Browse files
committed
ValidateVersion() regression, simplified code
1 parent f32111e commit 37d64cc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/UserAgentParser.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,15 @@ private function blacklistCheck($input)
134134
private function validateVersion()
135135
{
136136
$this->blacklistCheck($this->version);
137-
if (
138-
!empty($this->version) &&
137+
if (!empty($this->version) &&
139138
(
140139
str_replace('+', '', filter_var($this->version, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)) !== $this->version ||
141140
version_compare($this->version, '0.0.1', '>=') === false
142141
)
143142
) {
144143
throw new VersionException("Invalid version format (`$this->version`). See http://semver.org/ for guidelines. In addition, dev/alpha/beta/rc tags is disallowed. See also " . self::RFC_README);
145144
}
146-
$new = trim($this->version, '.0');
147-
$this->version = empty($new) ? null : $new;
145+
$this->version = trim($this->version, '.0');
148146
return true;
149147
}
150148

0 commit comments

Comments
 (0)