Passed
Pull Request — master (#656)
by Abdul Malik
14:10 queued 04:21
created
src/Stempler/tests/TraverserTest.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
         $doc = $this->parse('<a href="url"></a>');
40 40
 
41 41
         $t = new Traverser();
42
-        $t->addVisitor(new class() implements VisitorInterface {
42
+        $t->addVisitor(new class() implements VisitorInterface{
43 43
             public function enterNode($node, VisitorContext $ctx): void
44 44
             {
45
-                if ($node instanceof Tag && $node->name == 'a') {
45
+                if ($node instanceof Tag && $node->name == 'a'){
46 46
                     $node->name = 'b';
47 47
                 }
48 48
             }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         $doc = $this->parse('<a href="url"></a>');
66 66
 
67 67
         $t = new Traverser();
68
-        $t->addVisitor(new class() implements VisitorInterface {
68
+        $t->addVisitor(new class() implements VisitorInterface{
69 69
             public function enterNode($node, VisitorContext $ctx): void
70 70
             {
71 71
             }
72 72
 
73 73
             public function leaveNode($node, VisitorContext $ctx)
74 74
             {
75
-                if ($node instanceof Tag && $node->name == 'a') {
75
+                if ($node instanceof Tag && $node->name == 'a'){
76 76
                     $new = new Tag();
77 77
                     $new->name = 'link';
78 78
                     $new->void = true;
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
         $doc = $this->parse('<a href="url"><b></b>hello</a>');
98 98
 
99 99
         $t = new Traverser();
100
-        $t->addVisitor(new class() implements VisitorInterface {
100
+        $t->addVisitor(new class() implements VisitorInterface{
101 101
             public function enterNode($node, VisitorContext $ctx): void
102 102
             {
103 103
             }
104 104
 
105 105
             public function leaveNode($node, VisitorContext $ctx)
106 106
             {
107
-                if ($node instanceof Tag && $node->name == 'b') {
107
+                if ($node instanceof Tag && $node->name == 'b'){
108 108
                     return VisitorInterface::REMOVE_NODE;
109 109
                 }
110 110
             }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public function enterNode($node, VisitorContext $ctx): void
132 132
     {
133
-        if ($ctx->getCurrentNode() instanceof Raw) {
133
+        if ($ctx->getCurrentNode() instanceof Raw){
134 134
             $this->assertInstanceOf(Tag::class, $ctx->getParentNode());
135 135
             $this->assertSame('b', $ctx->getParentNode()->name);
136 136
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,10 +39,12 @@  discard block
 block discarded – undo
39 39
         $doc = $this->parse('<a href="url"></a>');
40 40
 
41 41
         $t = new Traverser();
42
-        $t->addVisitor(new class() implements VisitorInterface {
42
+        $t->addVisitor(new class() implements VisitorInterface
43
+        {
43 44
             public function enterNode($node, VisitorContext $ctx): void
44 45
             {
45
-                if ($node instanceof Tag && $node->name == 'a') {
46
+                if ($node instanceof Tag && $node->name == 'a')
47
+                {
46 48
                     $node->name = 'b';
47 49
                 }
48 50
             }
@@ -65,14 +67,16 @@  discard block
 block discarded – undo
65 67
         $doc = $this->parse('<a href="url"></a>');
66 68
 
67 69
         $t = new Traverser();
68
-        $t->addVisitor(new class() implements VisitorInterface {
70
+        $t->addVisitor(new class() implements VisitorInterface
71
+        {
69 72
             public function enterNode($node, VisitorContext $ctx): void
70 73
             {
71 74
             }
72 75
 
73 76
             public function leaveNode($node, VisitorContext $ctx)
74 77
             {
75
-                if ($node instanceof Tag && $node->name == 'a') {
78
+                if ($node instanceof Tag && $node->name == 'a')
79
+                {
76 80
                     $new = new Tag();
77 81
                     $new->name = 'link';
78 82
                     $new->void = true;
@@ -97,14 +101,16 @@  discard block
 block discarded – undo
97 101
         $doc = $this->parse('<a href="url"><b></b>hello</a>');
98 102
 
99 103
         $t = new Traverser();
100
-        $t->addVisitor(new class() implements VisitorInterface {
104
+        $t->addVisitor(new class() implements VisitorInterface
105
+        {
101 106
             public function enterNode($node, VisitorContext $ctx): void
102 107
             {
103 108
             }
104 109
 
105 110
             public function leaveNode($node, VisitorContext $ctx)
106 111
             {
107
-                if ($node instanceof Tag && $node->name == 'b') {
112
+                if ($node instanceof Tag && $node->name == 'b')
113
+                {
108 114
                     return VisitorInterface::REMOVE_NODE;
109 115
                 }
110 116
             }
@@ -130,7 +136,8 @@  discard block
 block discarded – undo
130 136
 
131 137
     public function enterNode($node, VisitorContext $ctx): void
132 138
     {
133
-        if ($ctx->getCurrentNode() instanceof Raw) {
139
+        if ($ctx->getCurrentNode() instanceof Raw)
140
+        {
134 141
             $this->assertInstanceOf(Tag::class, $ctx->getParentNode());
135 142
             $this->assertSame('b', $ctx->getParentNode()->name);
136 143
 
Please login to merge, or discard this patch.
src/Stempler/tests/BufferTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function testIterate(): void
32 32
     {
33 33
         $out = '';
34
-        foreach ($this->buffer('abc') as $n) {
34
+        foreach ($this->buffer('abc') as $n){
35 35
             $out .= $n->char;
36 36
         }
37 37
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     private function generate(StreamInterface $src)
153 153
     {
154
-        while (!$src->isEOI()) {
154
+        while (!$src->isEOI()){
155 155
             yield new Byte($src->getOffset(), $src->peak());
156 156
         }
157 157
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
     public function testIterate(): void
32 32
     {
33 33
         $out = '';
34
-        foreach ($this->buffer('abc') as $n) {
34
+        foreach ($this->buffer('abc') as $n)
35
+        {
35 36
             $out .= $n->char;
36 37
         }
37 38
 
@@ -151,7 +152,8 @@  discard block
 block discarded – undo
151 152
 
152 153
     private function generate(StreamInterface $src)
153 154
     {
154
-        while (!$src->isEOI()) {
155
+        while (!$src->isEOI())
156
+        {
155 157
             yield new Byte($src->getOffset(), $src->peak());
156 158
         }
157 159
     }
Please login to merge, or discard this patch.
src/Stempler/tests/Grammar/BaseTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $parsed = $this->tokens($source);
29 29
 
30
-        if (count($tokens) !== count($parsed)) {
30
+        if (count($tokens) !== count($parsed)){
31 31
             $this->fail('Token count mismatch');
32 32
         }
33 33
 
34
-        foreach ($tokens as $index => $token) {
34
+        foreach ($tokens as $index => $token){
35 35
             $this->assertSame($token->type, $parsed[$index]->type, 'Token type mismatch');
36 36
             $this->assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch');
37 37
             $this->assertSame($token->content, $parsed[$index]->content, 'Token content mismatch');
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
     protected function tokens(string $source): array
42 42
     {
43 43
         $lexer = new Lexer();
44
-        foreach (static::GRAMMARS as $grammar) {
44
+        foreach (static::GRAMMARS as $grammar){
45 45
             $lexer->addGrammar(new $grammar());
46 46
         }
47 47
 
48 48
         $tokens = [];
49
-        foreach ($lexer->parse(new StringStream($source)) as $t) {
49
+        foreach ($lexer->parse(new StringStream($source)) as $t){
50 50
             $tokens[] = $t;
51 51
         }
52 52
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,11 +27,13 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $parsed = $this->tokens($source);
29 29
 
30
-        if (count($tokens) !== count($parsed)) {
30
+        if (count($tokens) !== count($parsed))
31
+        {
31 32
             $this->fail('Token count mismatch');
32 33
         }
33 34
 
34
-        foreach ($tokens as $index => $token) {
35
+        foreach ($tokens as $index => $token)
36
+        {
35 37
             $this->assertSame($token->type, $parsed[$index]->type, 'Token type mismatch');
36 38
             $this->assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch');
37 39
             $this->assertSame($token->content, $parsed[$index]->content, 'Token content mismatch');
@@ -41,12 +43,14 @@  discard block
 block discarded – undo
41 43
     protected function tokens(string $source): array
42 44
     {
43 45
         $lexer = new Lexer();
44
-        foreach (static::GRAMMARS as $grammar) {
46
+        foreach (static::GRAMMARS as $grammar)
47
+        {
45 48
             $lexer->addGrammar(new $grammar());
46 49
         }
47 50
 
48 51
         $tokens = [];
49
-        foreach ($lexer->parse(new StringStream($source)) as $t) {
52
+        foreach ($lexer->parse(new StringStream($source)) as $t)
53
+        {
50 54
             $tokens[] = $t;
51 55
         }
52 56
 
Please login to merge, or discard this patch.
src/Stempler/tests/Grammar/RawTestTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $parsed = $this->tokens($source);
35 35
 
36
-        if (count($tokens) !== count($parsed)) {
36
+        if (count($tokens) !== count($parsed)){
37 37
             $this->fail('Token count mismatch');
38 38
         }
39 39
 
40
-        foreach ($tokens as $index => $token) {
40
+        foreach ($tokens as $index => $token){
41 41
             $this->assertSame($token->type, $parsed[$index]->type, 'Token type mismatch');
42 42
             $this->assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch');
43 43
             $this->assertSame($token->content, $parsed[$index]->content, 'Token content mismatch');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $lexer = new Lexer();
50 50
 
51 51
         $tokens = [];
52
-        foreach ($lexer->parse(new StringStream($source)) as $t) {
52
+        foreach ($lexer->parse(new StringStream($source)) as $t){
53 53
             $tokens[] = $t;
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,11 +33,13 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $parsed = $this->tokens($source);
35 35
 
36
-        if (count($tokens) !== count($parsed)) {
36
+        if (count($tokens) !== count($parsed))
37
+        {
37 38
             $this->fail('Token count mismatch');
38 39
         }
39 40
 
40
-        foreach ($tokens as $index => $token) {
41
+        foreach ($tokens as $index => $token)
42
+        {
41 43
             $this->assertSame($token->type, $parsed[$index]->type, 'Token type mismatch');
42 44
             $this->assertSame($token->offset, $parsed[$index]->offset, 'Token offset mismatch');
43 45
             $this->assertSame($token->content, $parsed[$index]->content, 'Token content mismatch');
@@ -49,7 +51,8 @@  discard block
 block discarded – undo
49 51
         $lexer = new Lexer();
50 52
 
51 53
         $tokens = [];
52
-        foreach ($lexer->parse(new StringStream($source)) as $t) {
54
+        foreach ($lexer->parse(new StringStream($source)) as $t)
55
+        {
53 56
             $tokens[] = $t;
54 57
         }
55 58
 
Please login to merge, or discard this patch.
src/Stempler/tests/Directive/BaseTest.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
     protected const DIRECTIVES = [];
37 37
 
38 38
     /**
39
- * @param Template $document
40
- * @return string
41
- */
39
+     * @param Template $document
40
+     * @return string
41
+     */
42 42
     protected function compile(Template $document): string
43 43
     {
44 44
         $compiler = new Compiler();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@
 block discarded – undo
42 42
     protected function compile(Template $document): string
43 43
     {
44 44
         $compiler = new Compiler();
45
-        foreach (static::RENDERS as $renderer) {
45
+        foreach (static::RENDERS as $renderer){
46 46
             $compiler->addRenderer(new $renderer());
47 47
         }
48 48
 
49 49
         $directiveGroup = new DirectiveGroup();
50
-        foreach (static::DIRECTIVES as $directive) {
50
+        foreach (static::DIRECTIVES as $directive){
51 51
             $directiveGroup->addDirective(new $directive());
52 52
         }
53 53
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,14 @@
 block discarded – undo
42 42
     protected function compile(Template $document): string
43 43
     {
44 44
         $compiler = new Compiler();
45
-        foreach (static::RENDERS as $renderer) {
45
+        foreach (static::RENDERS as $renderer)
46
+        {
46 47
             $compiler->addRenderer(new $renderer());
47 48
         }
48 49
 
49 50
         $directiveGroup = new DirectiveGroup();
50
-        foreach (static::DIRECTIVES as $directive) {
51
+        foreach (static::DIRECTIVES as $directive)
52
+        {
51 53
             $directiveGroup->addDirective(new $directive());
52 54
         }
53 55
 
Please login to merge, or discard this patch.
src/Stempler/tests/Syntax/BaseTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     {
31 31
         $parser = new Parser();
32 32
 
33
-        foreach (static::GRAMMARS as $grammar => $syntax) {
33
+        foreach (static::GRAMMARS as $grammar => $syntax){
34 34
             $parser->addSyntax(new $grammar(), new $syntax());
35 35
         }
36 36
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
30 30
     {
31 31
         $parser = new Parser();
32 32
 
33
-        foreach (static::GRAMMARS as $grammar => $syntax) {
33
+        foreach (static::GRAMMARS as $grammar => $syntax)
34
+        {
34 35
             $parser->addSyntax(new $grammar(), new $syntax());
35 36
         }
36 37
 
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/TestCase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     protected function makeApp(array $env): App
26 26
     {
27 27
         $config = [
28
-            'root' => __DIR__ . '/App',
29
-            'app'  => __DIR__ . '/App',
28
+            'root' => __DIR__.'/App',
29
+            'app'  => __DIR__.'/App',
30 30
         ];
31 31
 
32 32
         return App::init($config, new Environment($env), false);
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/IntegrationTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         array $headers = []
52 52
     ): ResponseInterface {
53 53
         $r = $this->request($uri, 'GET', [], $headers, []);
54
-        foreach ($attributes as $k => $v) {
54
+        foreach ($attributes as $k => $v){
55 55
             $r = $r->withAttribute($k, $v);
56 56
         }
57 57
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function fetchCookies(array $header)
96 96
     {
97 97
         $result = [];
98
-        foreach ($header as $line) {
98
+        foreach ($header as $line){
99 99
             $cookie = explode('=', $line);
100 100
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
101 101
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
         array $headers = []
52 52
     ): ResponseInterface {
53 53
         $r = $this->request($uri, 'GET', [], $headers, []);
54
-        foreach ($attributes as $k => $v) {
54
+        foreach ($attributes as $k => $v)
55
+        {
55 56
             $r = $r->withAttribute($k, $v);
56 57
         }
57 58
 
@@ -95,7 +96,8 @@  discard block
 block discarded – undo
95 96
     public function fetchCookies(array $header)
96 97
     {
97 98
         $result = [];
98
-        foreach ($header as $line) {
99
+        foreach ($header as $line)
100
+        {
99 101
             $cookie = explode('=', $line);
100 102
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
101 103
         }
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/Database/EntityCommand.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         ['name', InputArgument::REQUIRED, 'Entity name'],
34 34
         ['format', InputArgument::OPTIONAL, 'Declaration format (annotated, xml?, yaml?, php?)', 'annotated'],
35 35
     ];
36
-    protected const OPTIONS     = [
36
+    protected const OPTIONS = [
37 37
         [
38 38
             'role',
39 39
             'r',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository')){
112 112
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 113
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 114
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         $declaration->setDatabase((string)$this->option('database'));
121 121
         $declaration->setInflection((string)$this->option('inflection'));
122 122
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
123
+        foreach ($this->option('field') as $field){
124
+            if (strpos($field, ':') === false){
125 125
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 126
             }
127 127
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $this->writeDeclaration($declaration);
137 137
 
138
-        if ($this->option('repository')) {
138
+        if ($this->option('repository')){
139 139
             $console->run('create:repository', [
140 140
                 'name' => $repository ?? $this->argument('name'),
141 141
             ]);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             AbstractDeclaration::ACCESS_PROTECTED,
163 163
             AbstractDeclaration::ACCESS_PRIVATE,
164 164
             ], true)
165
-        ) {
165
+        ){
166 166
             throw new ScaffolderException("Invalid accessibility value `$accessibility`");
167 167
         }
168 168
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository'))
112
+        {
112 113
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 114
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 115
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +121,10 @@  discard block
 block discarded – undo
120 121
         $declaration->setDatabase((string)$this->option('database'));
121 122
         $declaration->setInflection((string)$this->option('inflection'));
122 123
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
124
+        foreach ($this->option('field') as $field)
125
+        {
126
+            if (strpos($field, ':') === false)
127
+            {
125 128
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 129
             }
127 130
 
@@ -135,7 +138,8 @@  discard block
 block discarded – undo
135 138
 
136 139
         $this->writeDeclaration($declaration);
137 140
 
138
-        if ($this->option('repository')) {
141
+        if ($this->option('repository'))
142
+        {
139 143
             $console->run('create:repository', [
140 144
                 'name' => $repository ?? $this->argument('name'),
141 145
             ]);
Please login to merge, or discard this patch.