Skip to content

Commit d961f46

Browse files
committed
cs fixes
1 parent d81e994 commit d961f46

19 files changed

+26
-27
lines changed

src/Query/Parsers/Parser.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class Parser
3434
*/
3535
protected Iterator $tokens;
3636

37-
public function __construct(string|Iterator $query) {
37+
public function __construct(string|Iterator $query)
38+
{
3839
if (is_string($query) === true) {
3940
$tokenizer = new Tokenizer($query);
4041
$query = $tokenizer->tokens();
@@ -121,7 +122,7 @@ private function atomic(): Node
121122
* Assert that all elements are VariableNodes
122123
* @var VariableNode[] $list
123124
*/
124-
foreach($list as $element) {
125+
foreach ($list as $element) {
125126
if ($element instanceof VariableNode === false) {
126127
throw new Exception('Expecting only variables in closure argument list.');
127128
}
@@ -178,7 +179,7 @@ private function coalesce(): Node
178179
/**
179180
* Collect the next token of a type
180181
*
181-
* @throws Exception when next token is not of specified type
182+
* @throws \Exception when next token is not of specified type
182183
*/
183184
protected function consume(
184185
TokenType $type,

src/Query/Parsers/Tokenizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function match(
8484
*
8585
* @param int $current The current position in the source string
8686
*
87-
* @throws Exception If an unexpected character is encountered
87+
* @throws \Exception If an unexpected character is encountered
8888
*/
8989
public static function token(string $query, int $current): Token
9090
{

src/Query/Runners/Interpreted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ functions: $self->functions,
5959
*
6060
* @param array $context Optional variables to be passed to the query
6161
*
62-
* @throws Exception when query is invalid or executor not callable
62+
* @throws \Exception when query is invalid or executor not callable
6363
*/
6464
public function run(string $query, array $context = []): mixed
6565
{

src/Query/Runners/Runner.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use ArrayAccess;
66
use Closure;
7-
use Exception;
87
use Kirby\Query\Query;
98

109
/**
@@ -38,7 +37,7 @@ abstract public static function for(Query $query): static;
3837
*
3938
* @param array $context Optional variables to be passed to the query
4039
*
41-
* @throws Exception when query is invalid or executor not callable
40+
* @throws \Exception when query is invalid or executor not callable
4241
*/
4342
abstract public function run(string $query, array $context = []): mixed;
4443
}

src/Query/Runners/Transpiled.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use ArrayAccess;
66
use Closure;
7-
use Exception;
87
use Kirby\Cms\App;
98
use Kirby\Filesystem\F;
109
use Kirby\Query\AST\Node;
@@ -138,7 +137,7 @@ protected function resolver(string $query): Closure
138137
*
139138
* @param array $context Optional variables to be passed to the query
140139
*
141-
* @throws Exception when query is invalid or executor not callable
140+
* @throws \Exception when query is invalid or executor not callable
142141
*/
143142
public function run(string $query, array $context = []): mixed
144143
{

tests/Query/AST/ArgumentListNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/ArrayListNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/ClosureNodeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**
@@ -33,7 +33,7 @@ public function testResolve(): void
3333
$visitor = new Transpiler();
3434
$this->assertSame(
3535
'fn($_3904355907, $_1908338681) => ($_3904355907 ?? $_1908338681)',
36-
$node->resolve($visitor)
36+
$node->resolve($visitor)
3737
);
3838
}
3939
}

tests/Query/AST/CoalesceNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/GlobalFunctionNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/LiteralNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/MemberAccessNodeTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

9-
class UserMock {
9+
class UserMock
10+
{
1011
public function name(): string
1112
{
1213
return 'foo';
@@ -42,7 +43,7 @@ public function testResolve(): void
4243
'name'
4344
);
4445

45-
$context = ['user' => new UserMock];
46+
$context = ['user' => new UserMock()];
4647

4748
// Interpreter
4849
$visitor = new Interpreter(context: $context);

tests/Query/AST/TernaryNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/AST/VariableNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Kirby\Query\AST;
44

5-
use Kirby\Query\Visitors\Transpiler;
65
use Kirby\Query\Visitors\Interpreter;
6+
use Kirby\Query\Visitors\Transpiler;
77
use Kirby\TestCase;
88

99
/**

tests/Query/Parsers/ParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Kirby\Query\Parsers;
44

5-
use Kirby\TestCase;
65
use Kirby\Query\AST\ArgumentListNode;
76
use Kirby\Query\AST\ArrayListNode;
87
use Kirby\Query\AST\ClosureNode;
@@ -12,6 +11,7 @@
1211
use Kirby\Query\AST\MemberAccessNode;
1312
use Kirby\Query\AST\TernaryNode;
1413
use Kirby\Query\AST\VariableNode;
14+
use Kirby\TestCase;
1515

1616
/**
1717
* @coversDefaultClass \Kirby\Query\Parsers\Parser

tests/Query/QueryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testResolveWithInterceptor()
130130
$query = new class ('foo.getObj.name') extends Query {
131131
public function intercept($result): mixed
132132
{
133-
if(is_object($result) === true) {
133+
if (is_object($result) === true) {
134134
$result = clone $result;
135135
$result->name .= ' simpson';
136136
}

tests/Query/Runners/InterpretedTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Kirby\Query\Runners;
44

55
use ArrayAccess;
6-
use Kirby\Query\Runners\Interpreted;
76

87
/**
98
* @coversDefaultClass \Kirby\Query\Runners\Interpreted

tests/Query/Runners/RuntimeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use Exception;
66

7-
class FooObj {
7+
class FooObj
8+
{
89
public string $bax = 'qox';
910

1011
public function print(string $string = 'bar'): string
@@ -46,7 +47,7 @@ public function testAccessWithArray(): void
4647
*/
4748
public function testAccessWithObject(): void
4849
{
49-
$obj = new FooObj;
50+
$obj = new FooObj();
5051
$result = Runtime::access($obj, 'print');
5152
$this->assertSame('bar', $result);
5253

tests/Query/Runners/TranspiledTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Kirby\Query\Runners;
44

55
use Kirby\Query\Parsers\Parser;
6-
use Kirby\Query\Runners\Transpiled;
76
use Kirby\Query\Visitors\Transpiler;
87
use Kirby\Toolkit\Str;
98

0 commit comments

Comments
 (0)