Skip to content

Commit 4b40d69

Browse files
committed
Code style updates.
1 parent 6df160a commit 4b40d69

File tree

108 files changed

+977
-980
lines changed

Some content is hidden

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

108 files changed

+977
-980
lines changed

src/Context.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
*/
4141
class Context implements \ArrayAccess
4242
{
43-
private array $keys = array();
44-
private array $values = array();
45-
private array $frozen = array();
46-
private array $raw = array();
43+
private array $keys = [];
44+
private array $values = [];
45+
private array $frozen = [];
46+
private array $raw = [];
4747

4848
private $shared;
4949
private $protected;
@@ -56,10 +56,10 @@ class Context implements \ArrayAccess
5656
*
5757
* @param array $values (default: array())
5858
*/
59-
public function __construct(array $values = array())
59+
public function __construct(array $values = [])
6060
{
61-
$this->shared = new \SplObjectStorage;
62-
$this->protected = new \SplObjectStorage;
61+
$this->shared = new \SplObjectStorage();
62+
$this->protected = new \SplObjectStorage();
6363

6464
foreach ($values as $key => $value) {
6565
$this->offsetSet($key, $value);
@@ -71,7 +71,7 @@ public function __construct(array $values = array())
7171
*
7272
* @param string $name The unique name for the fact
7373
*
74-
* @return boolean
74+
* @return bool
7575
*/
7676
public function offsetExists($name): bool
7777
{
@@ -83,9 +83,9 @@ public function offsetExists($name): bool
8383
*
8484
* @param string $name The unique name for the fact
8585
*
86-
* @return mixed The resolved value of the fact
87-
*
8886
* @throws \InvalidArgumentException if the name is not defined
87+
*
88+
* @return mixed The resolved value of the fact
8989
*/
9090
#[\ReturnTypeWillChange]
9191
public function offsetGet($name)
@@ -104,7 +104,7 @@ public function offsetGet($name)
104104
// If this is a shared value, resolve, freeze, and return the result
105105
if ($this->shared->contains($value)) {
106106
$this->frozen[$name] = true;
107-
$this->raw[$name] = $value;
107+
$this->raw[$name] = $value;
108108

109109
return $this->values[$name] = $value($this);
110110
}
@@ -130,12 +130,12 @@ public function offsetSet($name, $value): void
130130
throw new \RuntimeException(sprintf('Cannot override frozen fact "%s".', $name));
131131
}
132132

133-
$this->keys[$name] = true;
133+
$this->keys[$name] = true;
134134
$this->values[$name] = $value;
135135
}
136136

137137
/**
138-
* Unset a fact
138+
* Unset a fact.
139139
*
140140
* @param string $name The unique name for the fact
141141
*/
@@ -159,9 +159,9 @@ public function offsetUnset($name): void
159159
*
160160
* @param callable $callable A fact callable to share
161161
*
162-
* @return callable The passed callable
163-
*
164162
* @throws \InvalidArgumentException if the callable is not a Closure or invokable object
163+
*
164+
* @return callable The passed callable
165165
*/
166166
public function share($callable)
167167
{
@@ -182,9 +182,9 @@ public function share($callable)
182182
*
183183
* @param callable $callable A callable to protect from being evaluated
184184
*
185-
* @return callable The passed callable
186-
*
187185
* @throws \InvalidArgumentException if the callable is not a Closure or invokable object
186+
*
187+
* @return callable The passed callable
188188
*/
189189
public function protect($callable)
190190
{
@@ -202,9 +202,9 @@ public function protect($callable)
202202
*
203203
* @param string $name The unique name for the fact
204204
*
205-
* @return mixed The value of the fact or the closure defining the fact
206-
*
207205
* @throws \InvalidArgumentException if the name is not defined
206+
*
207+
* @return mixed The value of the fact or the closure defining the fact
208208
*/
209209
public function raw($name)
210210
{
@@ -234,7 +234,7 @@ public function keys()
234234
*
235235
* @param mixed $callable
236236
*
237-
* @return boolean
237+
* @return bool
238238
*/
239239
protected function isCallable($callable)
240240
{

src/Operator.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class Operator
2020
public const BINARY = 'BINARY';
2121
public const MULTIPLE = 'MULTIPLE';
2222

23-
protected $operands = array();
23+
protected $operands = [];
2424

2525
/**
2626
* @param array $operands
@@ -37,17 +37,17 @@ public function getOperands()
3737
switch ($this->getOperandCardinality()) {
3838
case self::UNARY:
3939
if (1 != count($this->operands)) {
40-
throw new \LogicException(get_class($this) . ' takes only 1 operand');
40+
throw new \LogicException(get_class($this).' takes only 1 operand');
4141
}
4242
break;
4343
case self::BINARY:
4444
if (2 != count($this->operands)) {
45-
throw new \LogicException(get_class($this) . ' takes 2 operands');
45+
throw new \LogicException(get_class($this).' takes 2 operands');
4646
}
4747
break;
4848
case self::MULTIPLE:
4949
if (0 == count($this->operands)) {
50-
throw new \LogicException(get_class($this) . ' takes at least 1 operand');
50+
throw new \LogicException(get_class($this).' takes at least 1 operand');
5151
}
5252
break;
5353
}
@@ -56,5 +56,6 @@ public function getOperands()
5656
}
5757

5858
abstract public function addOperand($operand);
59+
5960
abstract protected function getOperandCardinality();
6061
}

src/Operator/Addition.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* An Addition Arithmetic Operator
19+
* An Addition Arithmetic Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Ceil.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Ceil Math Operator
19+
* A Ceil Math Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Complement.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Complement Set Operator
19+
* A Complement Set Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/ContainsSubset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ContainsSubset extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/Division.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Division Arithmetic Operator
19+
* A Division Arithmetic Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/DoesNotContainSubset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DoesNotContainSubset extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/EndsWith.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EndsWith extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/EndsWithInsensitive.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EndsWithInsensitive extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/EqualTo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EqualTo extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/Exponentiate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* An Exponentiate Math Operator
19+
* An Exponentiate Math Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Floor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Floor Math Operator
19+
* A Floor Math Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/GreaterThan.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GreaterThan extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/GreaterThanOrEqualTo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GreaterThanOrEqualTo extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/Intersect.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Set Intersection Operator
19+
* A Set Intersection Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/LessThan.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LessThan extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/LessThanOrEqualTo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LessThanOrEqualTo extends VariableOperator implements Proposition
2525
/**
2626
* @param Context $context Context with which to evaluate this Proposition
2727
*
28-
* @return boolean
28+
* @return bool
2929
*/
3030
public function evaluate(Context $context)
3131
{

src/Operator/LogicalAnd.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LogicalAnd extends LogicalOperator
2424
/**
2525
* @param Context $context Context with which to evaluate this Proposition
2626
*
27-
* @return boolean
27+
* @return bool
2828
*/
2929
public function evaluate(Context $context)
3030
{

src/Operator/LogicalNot.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LogicalNot extends LogicalOperator
2424
/**
2525
* @param Context $context Context with which to evaluate this Proposition
2626
*
27-
* @return boolean
27+
* @return bool
2828
*/
2929
public function evaluate(Context $context)
3030
{

src/Operator/LogicalOperator.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
use Ruler\Proposition;
1515

1616
/**
17-
* Logical operator base class
17+
* Logical operator base class.
1818
*
1919
* @author Justin Hileman <[email protected]>
2020
*/
2121
abstract class LogicalOperator extends PropositionOperator implements Proposition
2222
{
2323
/**
24-
* array of propositions
24+
* array of propositions.
2525
*
2626
* @param array $props
2727
*/
28-
public function __construct(array $props = array())
28+
public function __construct(array $props = [])
2929
{
3030
foreach ($props as $operand) {
3131
$this->addOperand($operand);

src/Operator/LogicalOr.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LogicalOr extends LogicalOperator
2424
/**
2525
* @param Context $context Context with which to evaluate this Proposition
2626
*
27-
* @return boolean
27+
* @return bool
2828
*/
2929
public function evaluate(Context $context)
3030
{

src/Operator/LogicalXor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LogicalXor extends LogicalOperator
2424
/**
2525
* @param Context $context Context with which to evaluate this Proposition
2626
*
27-
* @return boolean
27+
* @return bool
2828
*/
2929
public function evaluate(Context $context)
3030
{

src/Operator/Max.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A set max operator
19+
* A set max operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Min.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A set min operator
19+
* A set min operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Modulo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Modulo Arithmetic Operator
19+
* A Modulo Arithmetic Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

src/Operator/Multiplication.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
namespace Ruler\Operator;
1313

1414
use Ruler\Context;
15-
use Ruler\VariableOperand;
1615
use Ruler\Value;
16+
use Ruler\VariableOperand;
1717

1818
/**
19-
* A Multiplication Arithmetic Operator
19+
* A Multiplication Arithmetic Operator.
2020
*
2121
* @author Jordan Raub <[email protected]>
2222
*/

0 commit comments

Comments
 (0)