Skip to content

Commit e802153

Browse files
committed
Add type hinting
1 parent 1bb848d commit e802153

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Database/Query.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ class Query
2323
* Construct.
2424
*
2525
* Construct a new query object
26+
*
27+
* @param string $attribute
28+
* @param string $operator
29+
* @param mixed $operand
2630
*/
27-
public function __construct($attribute, $operator, $operand)
31+
public function __construct($attribute, $operator, $operand)
2832
{
2933
$this->attribute = $attribute;
3034
$this->operator = $operator;
@@ -105,18 +109,25 @@ public static function parse(string $filter): Query
105109
*
106110
* @param string $expression
107111
*
108-
* @return array
112+
* @return (string|mixed)[]
109113
*/
110114
public static function parseExpression(string $expression): array
111115
{
112116
//find location of parentheses in expression
117+
118+
/** @var int */
113119
$start = mb_strpos($expression, '(');
120+
/** @var int */
114121
$end = mb_strpos($expression, ')');
115122

116123
//extract the query method
124+
125+
/** @var string */
117126
$operator = mb_substr($expression, 0, $start);
118127

119128
//grab everything inside parentheses
129+
130+
/** @var mixed */
120131
$operand = mb_substr($expression,
121132
($start + 1), /* exclude open paren*/
122133
($end - $start - 1) /* exclude closed paren*/

0 commit comments

Comments
 (0)