ソースを参照

Fix phpcs errors

Mark Story 6 年 前
コミット
7e42b9ac10

+ 1 - 1
src/Datasource/Paginator.php

@@ -180,7 +180,7 @@ class Paginator implements PaginatorInterface
         if ($pagingParams['requestedPage'] > $pagingParams['page']) {
             throw new PageOutOfBoundsException([
                 'requestedPage' => $pagingParams['requestedPage'],
-                'pagingParams' => $this->_pagingParams
+                'pagingParams' => $this->_pagingParams,
             ]);
         }
 

+ 1 - 1
src/View/Helper/HtmlHelper.php

@@ -925,7 +925,7 @@ class HtmlHelper extends Helper
 
             $out[] = $this->formatTemplate('tableheader', [
                 'attrs' => $this->templater()->formatAttributes($attrs),
-                'content' => $content
+                'content' => $content,
             ]);
         }
 

+ 2 - 2
tests/TestCase/Datasource/PaginatorTest.php

@@ -33,7 +33,7 @@ class PaginatorTest extends TestCase
      */
     public $fixtures = [
         'core.Posts', 'core.Articles', 'core.ArticlesTags',
-        'core.Authors', 'core.AuthorsTags', 'core.Tags'
+        'core.Authors', 'core.AuthorsTags', 'core.Tags',
     ];
 
     /**
@@ -153,7 +153,7 @@ class PaginatorTest extends TestCase
                 'finder' => 'published',
                 'fields' => ['id', 'title'],
                 'maxLimit' => 10,
-            ]
+            ],
         ];
 
         $this->loadFixtures('Posts');

+ 54 - 54
tests/TestCase/Datasource/PaginatorTestTrait.php

@@ -93,7 +93,7 @@ trait PaginatorTestTrait
                 'contain' => ['PaginatorAuthor'],
                 'maxLimit' => 10,
                 'group' => 'PaginatorPosts.published',
-                'order' => ['PaginatorPosts.id' => 'ASC']
+                'order' => ['PaginatorPosts.id' => 'ASC'],
             ],
         ];
         $table = $this->_getMockPosts(['query']);
@@ -128,16 +128,16 @@ trait PaginatorTestTrait
         $this->loadFixtures('Posts');
         $settings = [
             'PaginatorPosts' => [
-                'finder' => ['author' => ['author_id' => 1]]
-            ]
+                'finder' => ['author' => ['author_id' => 1]],
+            ],
         ];
         $table = $this->getTableLocator()->get('PaginatorPosts');
 
         $expected = $table
             ->find('author', [
                 'conditions' => [
-                    'PaginatorPosts.author_id' => 1
-                ]
+                    'PaginatorPosts.author_id' => 1,
+                ],
             ])
             ->count();
         $result = $this->Paginator->paginate($table, [], $settings)->count();
@@ -318,7 +318,7 @@ trait PaginatorTestTrait
             'scope' => [
                 'page' => 2,
                 'limit' => 5,
-            ]
+            ],
         ];
 
         $settings = [
@@ -386,13 +386,13 @@ trait PaginatorTestTrait
     {
         $params = [
             'page' => 10,
-            'limit' => 10
+            'limit' => 10,
         ];
         $settings = [
             'page' => 1,
             'limit' => 20,
             'maxLimit' => 100,
-            'finder' => 'myCustomFind'
+            'finder' => 'myCustomFind',
         ];
         $defaults = $this->Paginator->getDefaults('Post', $settings);
         $result = $this->Paginator->mergeOptions($params, $defaults);
@@ -415,7 +415,7 @@ trait PaginatorTestTrait
     {
         $params = [
             'page' => 99,
-            'limit' => 75
+            'limit' => 75,
         ];
         $settings = [
             'page' => 1,
@@ -441,7 +441,7 @@ trait PaginatorTestTrait
             'fields' => ['bad.stuff'],
             'recursive' => 1000,
             'conditions' => ['bad.stuff'],
-            'contain' => ['bad']
+            'contain' => ['bad'],
         ];
         $settings = [
             'page' => 1,
@@ -467,7 +467,7 @@ trait PaginatorTestTrait
             'fields' => ['bad.stuff'],
             'recursive' => 1000,
             'conditions' => ['bad.stuff'],
-            'contain' => ['bad']
+            'contain' => ['bad'],
         ];
         $settings = [
             'page' => 1,
@@ -478,7 +478,7 @@ trait PaginatorTestTrait
         $defaults = $this->Paginator->getDefaults('Post', $settings);
         $result = $this->Paginator->mergeOptions($params, $defaults);
         $expected = [
-            'page' => 10, 'limit' => 10, 'maxLimit' => 100, 'fields' => ['bad.stuff'], 'whitelist' => ['limit', 'sort', 'page', 'direction', 'fields']
+            'page' => 10, 'limit' => 10, 'maxLimit' => 100, 'fields' => ['bad.stuff'], 'whitelist' => ['limit', 'sort', 'page', 'direction', 'fields'],
         ];
         $this->assertEquals($expected, $result);
     }
@@ -501,7 +501,7 @@ trait PaginatorTestTrait
             'limit' => 100,
             'maxLimit' => 100,
             'paramType' => 'named',
-            'whitelist' => ['limit', 'sort', 'page', 'direction']
+            'whitelist' => ['limit', 'sort', 'page', 'direction'],
         ];
         $this->assertEquals($expected, $result);
 
@@ -516,7 +516,7 @@ trait PaginatorTestTrait
             'limit' => 10,
             'maxLimit' => 10,
             'paramType' => 'named',
-            'whitelist' => ['limit', 'sort', 'page', 'direction']
+            'whitelist' => ['limit', 'sort', 'page', 'direction'],
         ];
         $this->assertEquals($expected, $result);
     }
@@ -533,7 +533,7 @@ trait PaginatorTestTrait
             'limit' => 2,
             'maxLimit' => 10,
             'order' => [
-                'Users.username' => 'asc'
+                'Users.username' => 'asc',
             ],
         ];
         $defaults = $this->Paginator->getDefaults('Post', $settings);
@@ -543,9 +543,9 @@ trait PaginatorTestTrait
             'limit' => 2,
             'maxLimit' => 10,
             'order' => [
-                'Users.username' => 'asc'
+                'Users.username' => 'asc',
             ],
-            'whitelist' => ['limit', 'sort', 'page', 'direction']
+            'whitelist' => ['limit', 'sort', 'page', 'direction'],
         ];
         $this->assertEquals($expected, $result);
 
@@ -554,7 +554,7 @@ trait PaginatorTestTrait
             'limit' => 100,
             'maxLimit' => 10,
             'order' => [
-                'Users.username' => 'asc'
+                'Users.username' => 'asc',
             ],
         ];
         $defaults = $this->Paginator->getDefaults('Post', $settings);
@@ -564,9 +564,9 @@ trait PaginatorTestTrait
             'limit' => 10,
             'maxLimit' => 10,
             'order' => [
-                'Users.username' => 'asc'
+                'Users.username' => 'asc',
             ],
-            'whitelist' => ['limit', 'sort', 'page', 'direction']
+            'whitelist' => ['limit', 'sort', 'page', 'direction'],
         ];
         $this->assertEquals($expected, $result);
     }
@@ -598,7 +598,7 @@ trait PaginatorTestTrait
         $params = [
             'page' => 1,
             'sort' => 'id',
-            'direction' => 'herp'
+            'direction' => 'herp',
         ];
         $this->Paginator->paginate($table, $params);
         $pagingParams = $this->Paginator->getPagingParams();
@@ -699,7 +699,7 @@ trait PaginatorTestTrait
         $queryParams = [
             'page' => 1,
             'sort' => 'title',
-            'direction' => 'asc'
+            'direction' => 'asc',
         ];
 
         $this->Paginator->paginate($table, $queryParams, $options);
@@ -741,10 +741,10 @@ trait PaginatorTestTrait
         $params = [
             'page' => 1,
             'sort' => 'id',
-            'direction' => 'herp'
+            'direction' => 'herp',
         ];
         $options = [
-            'sortWhitelist' => ['id']
+            'sortWhitelist' => ['id'],
         ];
         $this->Paginator->paginate($table, $params, $options);
         $pagingParams = $this->Paginator->getPagingParams();
@@ -774,7 +774,7 @@ trait PaginatorTestTrait
             $this->assertSame(
                 [
                     'requestedPage' => 3000,
-                    'pagingParams' => $this->Paginator->getPagingParams()
+                    'pagingParams' => $this->Paginator->getPagingParams(),
                 ],
                 $exception->getAttributes()
             );
@@ -810,7 +810,7 @@ trait PaginatorTestTrait
         $options = [
             'sort' => 'body',
             'direction' => 'asc',
-            'sortWhitelist' => ['title', 'id']
+            'sortWhitelist' => ['title', 'id'],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -829,7 +829,7 @@ trait PaginatorTestTrait
         $options = [
             'sort' => 'body',
             'direction' => 'asc',
-            'sortWhitelist' => ['body']
+            'sortWhitelist' => ['body'],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -853,11 +853,11 @@ trait PaginatorTestTrait
         $options = [
             'order' => [
                 'body' => 'asc',
-                'foo.bar' => 'asc'
+                'foo.bar' => 'asc',
             ],
             'sort' => 'body',
             'direction' => 'asc',
-            'sortWhitelist' => []
+            'sortWhitelist' => [],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -881,7 +881,7 @@ trait PaginatorTestTrait
         $options = [
             'sort' => 'score',
             'direction' => 'asc',
-            'sortWhitelist' => ['score']
+            'sortWhitelist' => ['score'],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -905,15 +905,15 @@ trait PaginatorTestTrait
         $options = [
             'order' => [
                 'body' => 'asc',
-                'foo.bar' => 'asc'
+                'foo.bar' => 'asc',
             ],
-            'sortWhitelist' => ['body', 'foo.bar']
+            'sortWhitelist' => ['body', 'foo.bar'],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
         $expected = [
             'model.body' => 'asc',
-            'foo.bar' => 'asc'
+            'foo.bar' => 'asc',
         ];
         $this->assertEquals($expected, $result['order']);
     }
@@ -926,7 +926,7 @@ trait PaginatorTestTrait
         $model = $this->getMockBuilder('Cake\Datasource\RepositoryInterface')
             ->setMethods([
                 'getAlias', 'hasField', 'alias', 'find', 'get', 'query', 'updateAll', 'deleteAll',
-                'exists', 'save', 'delete', 'newEntity', 'newEntities', 'patchEntity', 'patchEntities'
+                'exists', 'save', 'delete', 'newEntity', 'newEntities', 'patchEntity', 'patchEntities',
             ])
             ->getMock();
 
@@ -962,13 +962,13 @@ trait PaginatorTestTrait
         $options = [
             'order' => [
                 'author_id' => 'asc',
-                'title' => 'asc'
-            ]
+                'title' => 'asc',
+            ],
         ];
         $result = $this->Paginator->validateSort($model, $options);
         $expected = [
             'model.author_id' => 'asc',
-            'model.title' => 'asc'
+            'model.title' => 'asc',
         ];
 
         $this->assertEquals($expected, $result['order']);
@@ -988,15 +988,15 @@ trait PaginatorTestTrait
             'direction' => 'desc',
             'order' => [
                 'author_id' => 'asc',
-                'title' => 'asc'
-            ]
+                'title' => 'asc',
+            ],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
         $expected = [
             'model.created' => 'desc',
             'model.author_id' => 'asc',
-            'model.title' => 'asc'
+            'model.title' => 'asc',
         ];
         $this->assertEquals($expected, $result['order']);
 
@@ -1005,8 +1005,8 @@ trait PaginatorTestTrait
             'direction' => 'desc',
             'order' => [
                 'author_id' => 'asc',
-                'title' => 'asc'
-            ]
+                'title' => 'asc',
+            ],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -1030,8 +1030,8 @@ trait PaginatorTestTrait
             'sort' => 'created',
             'direction' => 'desc',
             'order' => [
-                'model.created' => 'asc'
-            ]
+                'model.created' => 'asc',
+            ],
         ];
         $result = $this->Paginator->validateSort($model, $options);
 
@@ -1054,7 +1054,7 @@ trait PaginatorTestTrait
         $model = $this->mockAliasHasFieldModel();
 
         $options = [
-            'order' => 'model.author_id DESC'
+            'order' => 'model.author_id DESC',
         ];
         $result = $this->Paginator->validateSort($model, $options);
         $expected = 'model.author_id DESC';
@@ -1164,7 +1164,7 @@ trait PaginatorTestTrait
             'maxLimit' => 100,
         ];
         $params = [
-            'limit' => '1000'
+            'limit' => '1000',
         ];
         $this->Paginator->paginate($table, $params, $settings);
         $pagingParams = $this->Paginator->getPagingParams();
@@ -1172,7 +1172,7 @@ trait PaginatorTestTrait
         $this->assertEquals(100, $pagingParams['PaginatorPosts']['perPage']);
 
         $params = [
-            'limit' => '10'
+            'limit' => '10',
         ];
         $this->Paginator->paginate($table, $params, $settings);
         $pagingParams = $this->Paginator->getPagingParams();
@@ -1190,7 +1190,7 @@ trait PaginatorTestTrait
     {
         $settings = [
             'finder' => 'published',
-            'limit' => 2
+            'limit' => 2,
         ];
         $table = $this->_getMockPosts(['query']);
         $query = $this->_getMockFindQuery();
@@ -1225,8 +1225,8 @@ trait PaginatorTestTrait
                 'contain' => ['PaginatorAuthor'],
                 'maxLimit' => 10,
                 'group' => 'PaginatorPosts.published',
-                'order' => ['PaginatorPosts.id' => 'ASC']
-            ]
+                'order' => ['PaginatorPosts.id' => 'ASC'],
+            ],
         ];
         $table = $this->_getMockPosts(['find']);
         $query = $this->_getMockFindQuery($table);
@@ -1285,8 +1285,8 @@ trait PaginatorTestTrait
                 'maxLimit' => 10,
                 'limit' => 5,
                 'group' => 'PaginatorPosts.published',
-                'order' => ['PaginatorPosts.id' => 'ASC']
-            ]
+                'order' => ['PaginatorPosts.id' => 'ASC'],
+            ],
         ];
         $table = $this->_getMockPosts(['find']);
         $query = $this->_getMockFindQuery($table);
@@ -1326,8 +1326,8 @@ trait PaginatorTestTrait
                     'title' => ['type' => 'string', 'null' => false],
                     'body' => 'text',
                     'published' => ['type' => 'string', 'length' => 1, 'default' => 'N'],
-                    '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]]
-                ]
+                    '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
+                ],
             ]])
             ->getMock();
     }

+ 2 - 2
tests/TestCase/Datasource/SimplePaginatorTest.php

@@ -117,7 +117,7 @@ class SimplePaginatorTest extends PaginatorTest
         $settings = [
             'finder' => 'list',
             'conditions' => ['PaginatorPosts.published' => 'Y'],
-            'limit' => 2
+            'limit' => 2,
         ];
         $results = $this->Paginator->paginate($table, [], $settings);
 
@@ -148,7 +148,7 @@ class SimplePaginatorTest extends PaginatorTest
                 'finder' => 'published',
                 'fields' => ['id', 'title'],
                 'maxLimit' => 10,
-            ]
+            ],
         ];
 
         $this->loadFixtures('Posts');

+ 2 - 2
tests/TestCase/Http/ServerRequestFactoryTest.php

@@ -308,7 +308,7 @@ class ServerRequestFactoryTest extends TestCase
                 'error' => 0,
                 'name' => 'file.txt',
                 'type' => 'text/plain',
-                'size' => 1234
+                'size' => 1234,
             ],
         ];
         $this->assertEquals($expected, $request->getData());
@@ -340,7 +340,7 @@ class ServerRequestFactoryTest extends TestCase
                 'error' => 0,
                 'name' => 'file.txt',
                 'type' => 'text/plain',
-                'size' => 1234
+                'size' => 1234,
             ],
         ];
         $this->assertEquals($expected, $request->getData());

+ 10 - 10
tests/TestCase/Http/ServerRequestTest.php

@@ -633,9 +633,9 @@ class ServerRequestTest extends TestCase
             'files' => [
                 [
                     'invalid' => [
-                        'data'
-                    ]
-                ]
+                        'data',
+                    ],
+                ],
             ],
         ]);
     }
@@ -704,12 +704,12 @@ class ServerRequestTest extends TestCase
             'flat' => ['existing'],
             'nested' => [
                 'name' => 'nested',
-                'file' => ['existing']
+                'file' => ['existing'],
             ],
             'deep' => [
                 0 => [
                     'name' => 'deep 1',
-                    'file' => ['existing']
+                    'file' => ['existing'],
                 ],
                 1 => [
                     'name' => 'deep 2',
@@ -736,7 +736,7 @@ class ServerRequestTest extends TestCase
                     0,
                     'nested.txt',
                     'text/plain'
-                )
+                ),
             ],
             'deep' => [
                 0 => [
@@ -747,7 +747,7 @@ class ServerRequestTest extends TestCase
                         0,
                         'deep-1.txt',
                         'text/plain'
-                    )
+                    ),
                 ],
                 1 => [
                     'name' => 'deep 2',
@@ -757,7 +757,7 @@ class ServerRequestTest extends TestCase
                         0,
                         'deep-2.txt',
                         'text/plain'
-                    )
+                    ),
                 ],
             ],
             0 => new UploadedFile(
@@ -775,14 +775,14 @@ class ServerRequestTest extends TestCase
                     0,
                     'numeric-nested.txt',
                     'text/plain'
-                )
+                ),
             ],
         ];
 
         $request = new ServerRequest([
             'files' => $files,
             'post' => $post,
-            'mergeFilesAsObjects' => true
+            'mergeFilesAsObjects' => true,
         ]);
 
         $this->assertEquals($expected, $request->getData());

+ 3 - 3
tests/TestCase/View/Helper/PaginatorHelperTest.php

@@ -3253,9 +3253,9 @@ class PaginatorHelperTest extends TestCase
                         'sort' => null,
                         'direction' => null,
                         'limit' => null,
-                    ]
-                ]
-            ]
+                    ],
+                ],
+            ],
         ]);
 
         $view = new View($request);