Skip to content

Commit eabedc3

Browse files
committed
Moar types.
1 parent bbe82cf commit eabedc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+153
-444
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ use Ruler\Value;
411411

412412
class ALotGreaterThan extends VariableOperator implements Proposition
413413
{
414-
public function evaluate(Context $context)
414+
public function evaluate(Context $context): bool
415415
{
416416
list($left, $right) = $this->getOperands();
417417
$value = $right->prepareValue($context)->getValue() * 10;

src/Context.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public function __construct(array $values = [])
7070
* Check if a fact is defined.
7171
*
7272
* @param string $name The unique name for the fact
73-
*
74-
* @return bool
7573
*/
7674
public function offsetExists($name): bool
7775
{
@@ -221,10 +219,8 @@ public function raw($name)
221219

222220
/**
223221
* Get all defined fact names.
224-
*
225-
* @return array An array of fact names
226222
*/
227-
public function keys()
223+
public function keys(): array
228224
{
229225
return \array_keys($this->keys);
230226
}
@@ -233,10 +229,8 @@ public function keys()
233229
* Check whether a value is a Closure or invokable object.
234230
*
235231
* @param mixed $callable
236-
*
237-
* @return bool
238232
*/
239-
protected function isCallable($callable)
233+
protected function isCallable($callable): bool
240234
{
241235
return \is_object($callable) && \is_callable($callable);
242236
}

src/Operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(...$operands)
3232
}
3333
}
3434

35-
public function getOperands()
35+
public function getOperands(): array
3636
{
3737
switch ($this->getOperandCardinality()) {
3838
case self::UNARY:

src/Operator/Addition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class Addition extends VariableOperator implements VariableOperand
2424
{
25-
public function prepareValue(Context $context)
25+
public function prepareValue(Context $context): Value
2626
{
2727
/** @var VariableOperand $left */
2828
/** @var VariableOperand $right */

src/Operator/Ceil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class Ceil extends VariableOperator implements VariableOperand
2424
{
25-
public function prepareValue(Context $context)
25+
public function prepareValue(Context $context): Value
2626
{
2727
/** @var VariableOperand $operand */
2828
[$operand] = $this->getOperands();

src/Operator/Complement.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Ruler\Context;
1515
use Ruler\Set;
16+
use Ruler\Value;
1617
use Ruler\VariableOperand;
1718

1819
/**
@@ -22,7 +23,7 @@
2223
*/
2324
class Complement extends VariableOperator implements VariableOperand
2425
{
25-
public function prepareValue(Context $context)
26+
public function prepareValue(Context $context): Value
2627
{
2728
$complement = null;
2829
/** @var VariableOperand $operand */

src/Operator/ContainsSubset.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class ContainsSubset extends VariableOperator implements Proposition
2424
{
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
27-
*
28-
* @return bool
2927
*/
30-
public function evaluate(Context $context)
28+
public function evaluate(Context $context): bool
3129
{
3230
/** @var VariableOperand $left */
3331
/** @var VariableOperand $right */

src/Operator/Division.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class Division extends VariableOperator implements VariableOperand
2424
{
25-
public function prepareValue(Context $context)
25+
public function prepareValue(Context $context): Value
2626
{
2727
/** @var VariableOperand $left */
2828
/** @var VariableOperand $right */

src/Operator/DoesNotContainSubset.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class DoesNotContainSubset extends VariableOperator implements Proposition
2424
{
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
27-
*
28-
* @return bool
2927
*/
30-
public function evaluate(Context $context)
28+
public function evaluate(Context $context): bool
3129
{
3230
/** @var VariableOperand $left */
3331
/** @var VariableOperand $right */

src/Operator/EndsWith.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ class EndsWith extends VariableOperator implements Proposition
2424
{
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
27-
*
28-
* @return bool
2927
*/
30-
public function evaluate(Context $context)
28+
public function evaluate(Context $context): bool
3129
{
3230
/** @var VariableOperand $left */
3331
/** @var VariableOperand $right */

0 commit comments

Comments
 (0)