Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Added float comparison null checks #33421

Merged
merged 1 commit into from
Jul 3, 2020
Merged

[6.x] Added float comparison null checks #33421

merged 1 commit into from
Jul 3, 2020

Conversation

GrahamCampbell
Copy link
Member

@@ -1179,6 +1179,10 @@ public function originalIsEquivalent($key, $current)
return $this->castAttribute($key, $current) ==
$this->castAttribute($key, $original);
} elseif ($this->hasCast($key, ['real', 'float', 'double'])) {
if (($current === null && $original !== null) || ($current !== null && $original === null)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be one the rare opportunities to use xor:

is_null($current) ^ is_null($original)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants