Skip to content

Commit

Permalink
IntervalDataSets do not call equals on incompatible types
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Dec 3, 2020
1 parent 5231003 commit 613a793
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Time/IntervalData/DateIntervalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Tracy\Debugger;
use function array_shift;
use function array_values;
use function get_class;
use function sprintf;
use function trim;

Expand Down Expand Up @@ -228,7 +229,7 @@ public function equals(Equalable $other): bool
*/
public function dataEquals($otherData): bool
{
if ($this->data instanceof Equalable && $otherData instanceof Equalable) {
if ($this->data instanceof Equalable && $otherData instanceof Equalable && get_class($this->data) === get_class($otherData)) {
return $this->data->equals($otherData);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Time/IntervalData/NightIntervalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Tracy\Debugger;
use function array_shift;
use function array_values;
use function get_class;
use function sprintf;
use function trim;

Expand Down Expand Up @@ -228,7 +229,7 @@ public function equals(Equalable $other): bool
*/
public function dataEquals($otherData): bool
{
if ($this->data instanceof Equalable && $otherData instanceof Equalable) {
if ($this->data instanceof Equalable && $otherData instanceof Equalable && get_class($this->data) === get_class($otherData)) {
return $this->data->equals($otherData);
}

Expand Down

0 comments on commit 613a793

Please sign in to comment.