Skip to content

Commit

Permalink
Added conversions to ReadonlyBoolean datatypes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Rafael Azevedo committed May 25, 2019
1 parent 620c14d commit 69af8e7
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 34 deletions.
14 changes: 0 additions & 14 deletions src/Scalar/AbstractWriteFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,4 @@ protected function doDivide(float $value): float
{
return ($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::fromFloat($this->value);
}
}
14 changes: 0 additions & 14 deletions src/Scalar/AbstractWriteInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,4 @@ 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);
}
}
1 change: 0 additions & 1 deletion src/Scalar/ImmutableInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,4 @@ public function toFloat(): ImmutableFloat
{
return ImmutableFloat::fromString($this->__toString());
}
//public function toBoolean(): ImmutableBoolean;
}
1 change: 0 additions & 1 deletion src/Scalar/MutableFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,4 @@ public function toInteger(): MutableInteger
{
return MutableInteger::fromString($this->__toString());
}
//public function toBoolean(): MutableBoolean;
}
2 changes: 0 additions & 2 deletions src/Scalar/MutableInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,4 @@ public function toFloat(): MutableFloat
{
return MutableFloat::fromString($this->__toString());
}

//public function toBoolean(): MutableBoolean;
}
14 changes: 13 additions & 1 deletion src/Scalar/ReadonlyFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,17 @@ public function toInteger(): ReadonlyInteger
return ReadonlyInteger::fromString($this->__toString());
}

//public function toBoolean(): ReandonlyBoolean;
/**
* 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::fromFloat($this->value);
}
}
14 changes: 13 additions & 1 deletion src/Scalar/ReadonlyInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,17 @@ public function toFloat(): ReadonlyFloat
return ReadonlyFloat::fromInteger($this->value);
}

//public function toBoolean(): ReandonlyBoolean;
/**
* Converts integer'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 69af8e7

Please sign in to comment.