Skip to content

Commit 5eacfbd

Browse files
Optimize code
1 parent c75911c commit 5eacfbd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/BooleanDates.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getAttribute($key)
4646
}
4747

4848
if ($this->hasBooleanDate($key)) {
49-
return ! is_null($this->attributes[$this->getBooleanDateField($key)]);
49+
return $this->attributes[$this->getBooleanDateField($key)] !== null;
5050
}
5151

5252
return parent::getAttribute($key);
@@ -60,7 +60,7 @@ public function getAttribute($key)
6060
*
6161
* @return $this
6262
*/
63-
public function setAttribute($key, $value)
63+
public function setAttribute($key, $value) : self
6464
{
6565
if ($this->hasBooleanDate($key)) {
6666
$this->setBooleanDate($key, $value);
@@ -124,7 +124,7 @@ public function currentBooleanDateFieldValueIsNotYetSet(string $key) : bool
124124
return true;
125125
}
126126

127-
return is_null($this->attributes[$this->getBooleanDateField($key)]);
127+
return $this->attributes[$this->getBooleanDateField($key)] === null;
128128
}
129129

130130
/**
@@ -159,7 +159,7 @@ protected function addBooleanDateAttributesToArray(array $attributes) : array
159159
continue;
160160
}
161161

162-
$attributes[$booleanField] = ! is_null($date);
162+
$attributes[$booleanField] = $date !== null;
163163
}
164164

165165
return $attributes;

0 commit comments

Comments
 (0)