Skip to content

Commit

Permalink
Added toBoolean() shared method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Rafael Azevedo committed May 25, 2019
1 parent ad85e31 commit 620c14d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Scalar/AbstractWriteInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,18 @@ protected function doDivide(int $value): int
{
return \intval($this->value / $value);
}

/**
* Converts float's instance to an equivalent boolean instance.
*
* A <i>ReadonlyBoolean</i> will be returned, as Booleans don't require Immutable and Mutable
* distinctions.
*
* @since 1.0.0
* @return ReadonlyBoolean
*/
public function toBoolean(): ReadonlyBoolean
{
return ReadonlyBoolean::fromInteger($this->value);
}
}

0 comments on commit 620c14d

Please sign in to comment.