Failed Conditions
Pull Request — master (#6593)
by Thomas
16:12
created
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -146,6 +146,12 @@  discard block
 block discarded – undo
146 146
         return [$user1, $user2, $user3];
147 147
     }
148 148
 
149
+    /**
150
+     * @param string $name
151
+     * @param string $username
152
+     * @param string $status
153
+     * @param CmsAddress $address
154
+     */
149 155
     public function buildUser($name, $username, $status, $address)
150 156
     {
151 157
         $user = new CmsUser();
@@ -160,6 +166,12 @@  discard block
 block discarded – undo
160 166
         return $user;
161 167
     }
162 168
 
169
+    /**
170
+     * @param string $country
171
+     * @param string $city
172
+     * @param string $street
173
+     * @param string $zip
174
+     */
163 175
     public function buildAddress($country, $city, $street, $zip)
164 176
     {
165 177
         $address = new CmsAddress();
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function testExceptionIsThrownWhenCallingFindByWithoutParameter() {
310 310
         $this->_em->getRepository(CmsUser::class)
311
-                  ->findByStatus();
311
+                    ->findByStatus();
312 312
     }
313 313
 
314 314
     /**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function testExceptionIsThrownWhenUsingInvalidFieldName() {
318 318
         $this->_em->getRepository(CmsUser::class)
319
-                  ->findByThisFieldDoesNotExist('testvalue');
319
+                    ->findByThisFieldDoesNotExist('testvalue');
320 320
     }
321 321
 
322 322
     /**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         $this->expectException(TransactionRequiredException::class);
329 329
 
330 330
         $this->_em->getRepository(CmsUser::class)
331
-                  ->find(1, LockMode::PESSIMISTIC_READ);
331
+                    ->find(1, LockMode::PESSIMISTIC_READ);
332 332
     }
333 333
 
334 334
     /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         $this->expectException(TransactionRequiredException::class);
341 341
 
342 342
         $this->_em->getRepository(CmsUser::class)
343
-                  ->find(1, LockMode::PESSIMISTIC_WRITE);
343
+                    ->find(1, LockMode::PESSIMISTIC_WRITE);
344 344
     }
345 345
 
346 346
     /**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         $this->expectException(OptimisticLockException::class);
353 353
 
354 354
         $this->_em->getRepository(CmsUser::class)
355
-                  ->find(1, LockMode::OPTIMISTIC);
355
+                    ->find(1, LockMode::OPTIMISTIC);
356 356
     }
357 357
 
358 358
     /**
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
      */
434 434
     public function testFindOneByOrderBy()
435 435
     {
436
-    	$this->loadFixture();
436
+        $this->loadFixture();
437 437
 
438
-    	$repos = $this->_em->getRepository(CmsUser::class);
439
-    	$userAsc = $repos->findOneBy([], ["username" => "ASC"]);
440
-    	$userDesc = $repos->findOneBy([], ["username" => "DESC"]);
438
+        $repos = $this->_em->getRepository(CmsUser::class);
439
+        $userAsc = $repos->findOneBy([], ["username" => "ASC"]);
440
+        $userDesc = $repos->findOneBy([], ["username" => "DESC"]);
441 441
 
442
-    	$this->assertNotSame($userAsc, $userDesc);
442
+        $this->assertNotSame($userAsc, $userDesc);
443 443
     }
444 444
 
445 445
     /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $repos = $this->_em->getRepository(CmsUser::class);
181 181
 
182 182
         $user = $repos->find($user1Id);
183
-        $this->assertInstanceOf(CmsUser::class,$user);
183
+        $this->assertInstanceOf(CmsUser::class, $user);
184 184
         $this->assertEquals('Roman', $user->name);
185 185
         $this->assertEquals('freak', $user->status);
186 186
     }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         $users = $repos->findBy(['status' => 'dev']);
194 194
         $this->assertEquals(2, count($users));
195
-        $this->assertInstanceOf(CmsUser::class,$users[0]);
195
+        $this->assertInstanceOf(CmsUser::class, $users[0]);
196 196
         $this->assertEquals('Guilherme', $users[0]->name);
197 197
         $this->assertEquals('dev', $users[0]->status);
198 198
     }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $addresses  = $repository->findBy(['user' => [$user1->getId(), $user2->getId()]]);
219 219
 
220 220
         $this->assertEquals(2, count($addresses));
221
-        $this->assertInstanceOf(CmsAddress::class,$addresses[0]);
221
+        $this->assertInstanceOf(CmsAddress::class, $addresses[0]);
222 222
     }
223 223
 
224 224
     public function testFindByAssociationWithObjectAsParameter()
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $addresses  = $repository->findBy(['user' => [$user1, $user2]]);
243 243
 
244 244
         $this->assertEquals(2, count($addresses));
245
-        $this->assertInstanceOf(CmsAddress::class,$addresses[0]);
245
+        $this->assertInstanceOf(CmsAddress::class, $addresses[0]);
246 246
     }
247 247
 
248 248
     public function testFindFieldByMagicCall()
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
         $users = $repos->findByStatus('dev');
254 254
         $this->assertEquals(2, count($users));
255
-        $this->assertInstanceOf(CmsUser::class,$users[0]);
255
+        $this->assertInstanceOf(CmsUser::class, $users[0]);
256 256
         $this->assertEquals('Guilherme', $users[0]->name);
257 257
         $this->assertEquals('dev', $users[0]->status);
258 258
     }
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         $this->assertEquals(2, count($usersAsc));
593 593
         $this->assertEquals(2, count($usersDesc));
594 594
 
595
-        $this->assertInstanceOf(CmsUser::class,$usersAsc[0]);
595
+        $this->assertInstanceOf(CmsUser::class, $usersAsc[0]);
596 596
         $this->assertEquals('Alexander', $usersAsc[0]->name);
597 597
         $this->assertEquals('dev', $usersAsc[0]->status);
598 598
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
     public function testCanRetrieveRepositoryFromClassNameWithLeadingBackslash()
674 674
     {
675 675
         $this->assertSame(
676
-            $this->_em->getRepository('\\' . CmsUser::class),
676
+            $this->_em->getRepository('\\'.CmsUser::class),
677 677
             $this->_em->getRepository(CmsUser::class)
678 678
         );
679 679
     }
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
         $data = $repo->findBy(['user' => [1, 2, 3]]);
712 712
 
713 713
         $query = array_pop($this->_sqlLoggerStack->queries);
714
-        $this->assertEquals([1,2,3], $query['params'][0]);
714
+        $this->assertEquals([1, 2, 3], $query['params'][0]);
715 715
         $this->assertEquals(Connection::PARAM_INT_ARRAY, $query['types'][0]);
716 716
     }
717 717
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/QueryTest.php 3 patches
Unused Use Statements   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,14 +3,13 @@
 block discarded – undo
3 3
 namespace Doctrine\Tests\ORM\Functional;
4 4
 
5 5
 use Doctrine\Common\Collections\ArrayCollection;
6
-
7 6
 use Doctrine\ORM\NonUniqueResultException;
8 7
 use Doctrine\ORM\Proxy\Proxy;
9 8
 use Doctrine\ORM\Query\QueryException;
10 9
 use Doctrine\ORM\UnexpectedResultException;
11
-use Doctrine\Tests\Models\CMS\CmsUser,
12
-    Doctrine\Tests\Models\CMS\CmsArticle,
13
-    Doctrine\Tests\Models\CMS\CmsPhonenumber;
10
+use Doctrine\Tests\Models\CMS\CmsUser;
11
+use Doctrine\Tests\Models\CMS\CmsArticle;
12
+use Doctrine\Tests\Models\CMS\CmsPhonenumber;
14 13
 use Doctrine\ORM\Mapping\ClassMetadata;
15 14
 use Doctrine\ORM\Query;
16 15
 use Doctrine\ORM\Query\Parameter;
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0');
149 149
 
150 150
         $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1')
151
-                  ->getSingleResult();
151
+                    ->getSingleResult();
152 152
     }
153 153
 
154 154
     public function testInvalidInputParameterThrowsException()
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
         $this->expectException(QueryException::class);
157 157
 
158 158
         $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?')
159
-                  ->setParameter(1, 'jwage')
160
-                  ->getSingleResult();
159
+                    ->setParameter(1, 'jwage')
160
+                    ->getSingleResult();
161 161
     }
162 162
 
163 163
     public function testSetParameters()
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
         $parameters->add(new Parameter(2, 'active'));
168 168
 
169 169
         $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
170
-                  ->setParameters($parameters)
171
-                  ->getResult();
170
+                    ->setParameters($parameters)
171
+                    ->getResult();
172 172
 
173 173
         $extractValue = function (Parameter $parameter) {
174 174
             return $parameter->getValue();
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
         $parameters = [1 => 'jwage', 2 => 'active'];
186 186
 
187 187
         $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
188
-                  ->setParameters($parameters)
189
-                  ->getResult();
188
+                    ->setParameters($parameters)
189
+                    ->getResult();
190 190
 
191 191
         self::assertSame(
192 192
             array_values($parameters),
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     public function testGetSingleResultThrowsExceptionOnNoResult()
331 331
     {
332 332
         $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
333
-             ->getSingleResult();
333
+                ->getSingleResult();
334 334
     }
335 335
 
336 336
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     public function testGetSingleScalarResultThrowsExceptionOnNoResult()
340 340
     {
341 341
         $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
342
-             ->getSingleScalarResult();
342
+                ->getSingleScalarResult();
343 343
     }
344 344
 
345 345
     /**
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         $this->_em->clear();
371 371
 
372 372
         $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a")
373
-             ->getSingleScalarResult();
373
+                ->getSingleScalarResult();
374 374
     }
375 375
 
376 376
     public function testModifiedLimitQuery()
@@ -387,27 +387,27 @@  discard block
 block discarded – undo
387 387
         $this->_em->clear();
388 388
 
389 389
         $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
390
-                  ->setFirstResult(1)
391
-                  ->setMaxResults(2)
392
-                  ->getResult();
390
+                    ->setFirstResult(1)
391
+                    ->setMaxResults(2)
392
+                    ->getResult();
393 393
 
394 394
         $this->assertEquals(2, count($data));
395 395
         $this->assertEquals('gblanco1', $data[0]->username);
396 396
         $this->assertEquals('gblanco2', $data[1]->username);
397 397
 
398 398
         $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
399
-                  ->setFirstResult(3)
400
-                  ->setMaxResults(2)
401
-                  ->getResult();
399
+                    ->setFirstResult(3)
400
+                    ->setMaxResults(2)
401
+                    ->getResult();
402 402
 
403 403
         $this->assertEquals(2, count($data));
404 404
         $this->assertEquals('gblanco3', $data[0]->username);
405 405
         $this->assertEquals('gblanco4', $data[1]->username);
406 406
 
407 407
         $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
408
-                  ->setFirstResult(3)
409
-                  ->setMaxResults(2)
410
-                  ->getScalarResult();
408
+                    ->setFirstResult(3)
409
+                    ->setMaxResults(2)
410
+                    ->getScalarResult();
411 411
     }
412 412
 
413 413
     public function testSupportsQueriesWithEntityNamespaces()
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
         $this->_em->clear();
477 477
 
478 478
         $articles = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a')
479
-                         ->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER)
480
-                         ->getResult();
479
+                            ->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER)
480
+                            ->getResult();
481 481
 
482 482
         $this->assertEquals(10, count($articles));
483 483
         foreach ($articles AS $article) {
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
     {
620 620
         $qb = $this->_em->createQueryBuilder();
621 621
         $qb->select('u')
622
-           ->from(CmsUser::class, 'u')
623
-           ->innerJoin('u.articles', 'a')
624
-           ->where('(u.id = 0) OR (u.id IS NULL)');
622
+            ->from(CmsUser::class, 'u')
623
+            ->innerJoin('u.articles', 'a')
624
+            ->where('(u.id = 0) OR (u.id IS NULL)');
625 625
 
626 626
         $query = $qb->getQuery();
627 627
         $users = $query->execute();
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->_em->flush();
95 95
         $this->_em->clear();
96 96
 
97
-        $query = $this->_em->createQuery('select u, a from ' . CmsUser::class . ' u join u.articles a ORDER BY a.topic');
97
+        $query = $this->_em->createQuery('select u, a from '.CmsUser::class.' u join u.articles a ORDER BY a.topic');
98 98
         $users = $query->getResult();
99 99
         $this->assertEquals(1, count($users));
100 100
         $this->assertInstanceOf(CmsUser::class, $users[0]);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $this->_em->flush();
114 114
         $this->_em->clear();
115 115
 
116
-        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.username = ?0');
116
+        $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.username = ?0');
117 117
         $q->setParameter(0, 'jwage');
118 118
         $user = $q->getSingleResult();
119 119
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $this->expectException(QueryException::class);
126 126
         $this->expectExceptionMessage('Invalid parameter: token 2 is not defined in the query.');
127 127
 
128
-        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1');
128
+        $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1');
129 129
         $q->setParameter(2, 'jwage');
130 130
         $user = $q->getSingleResult();
131 131
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $this->expectException(QueryException::class);
136 136
         $this->expectExceptionMessage('Too many parameters: the query defines 1 parameters and you bound 2');
137 137
 
138
-        $q = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1');
138
+        $q = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1');
139 139
         $q->setParameter(1, 'jwage');
140 140
         $q->setParameter(2, 'jwage');
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $this->expectException(QueryException::class);
148 148
         $this->expectExceptionMessage('Too few parameters: the query defines 1 parameters but you only bound 0');
149 149
 
150
-        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1')
150
+        $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1')
151 151
                   ->getSingleResult();
152 152
     }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $this->expectException(QueryException::class);
157 157
 
158
-        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?')
158
+        $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?')
159 159
                   ->setParameter(1, 'jwage')
160 160
                   ->getSingleResult();
161 161
     }
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
         $parameters->add(new Parameter(1, 'jwage'));
167 167
         $parameters->add(new Parameter(2, 'active'));
168 168
 
169
-        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
169
+        $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1 AND u.status = ?2')
170 170
                   ->setParameters($parameters)
171 171
                   ->getResult();
172 172
 
173
-        $extractValue = function (Parameter $parameter) {
173
+        $extractValue = function(Parameter $parameter) {
174 174
             return $parameter->getValue();
175 175
         };
176 176
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $parameters = [1 => 'jwage', 2 => 'active'];
186 186
 
187
-        $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u WHERE u.name = ?1 AND u.status = ?2')
187
+        $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u WHERE u.name = ?1 AND u.status = ?2')
188 188
                   ->setParameters($parameters)
189 189
                   ->getResult();
190 190
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $this->_em->clear();
215 215
         $articleId = $article1->id;
216 216
 
217
-        $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a WHERE a.topic = ?1');
217
+        $query = $this->_em->createQuery('select a from '.CmsArticle::class.' a WHERE a.topic = ?1');
218 218
         $articles = $query->iterate(new ArrayCollection([new Parameter(1, 'Doctrine 2')]), Query::HYDRATE_ARRAY);
219 219
 
220 220
         $found = [];
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
         $this->_em->flush();
256 256
         $this->_em->clear();
257 257
 
258
-        $query = $this->_em->createQuery('select a from ' . CmsArticle::class . ' a');
258
+        $query = $this->_em->createQuery('select a from '.CmsArticle::class.' a');
259 259
         $articles = $query->iterate();
260 260
 
261 261
         $iteratedCount = 0;
262 262
         $topics = [];
263 263
 
264
-        foreach($articles AS $row) {
264
+        foreach ($articles AS $row) {
265 265
             $article = $row[0];
266 266
             $topics[] = $article->topic;
267 267
 
268 268
             $identityMap = $this->_em->getUnitOfWork()->getIdentityMap();
269 269
             $identityMapCount = count($identityMap[CmsArticle::class]);
270
-            $this->assertTrue($identityMapCount>$iteratedCount);
270
+            $this->assertTrue($identityMapCount > $iteratedCount);
271 271
 
272 272
             $iteratedCount++;
273 273
         }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
         $iteratedCount = 0;
302 302
         $topics = [];
303
-        foreach($articles AS $row) {
303
+        foreach ($articles AS $row) {
304 304
             $article  = $row[0];
305 305
             $topics[] = $article->topic;
306 306
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
     {
378 378
         for ($i = 0; $i < 5; $i++) {
379 379
             $user = new CmsUser;
380
-            $user->name = 'Guilherme' . $i;
381
-            $user->username = 'gblanco' . $i;
380
+            $user->name = 'Guilherme'.$i;
381
+            $user->username = 'gblanco'.$i;
382 382
             $user->status = 'developer';
383 383
             $this->_em->persist($user);
384 384
         }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
         $this->_em->flush();
387 387
         $this->_em->clear();
388 388
 
389
-        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
389
+        $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u')
390 390
                   ->setFirstResult(1)
391 391
                   ->setMaxResults(2)
392 392
                   ->getResult();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         $this->assertEquals('gblanco1', $data[0]->username);
396 396
         $this->assertEquals('gblanco2', $data[1]->username);
397 397
 
398
-        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
398
+        $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u')
399 399
                   ->setFirstResult(3)
400 400
                   ->setMaxResults(2)
401 401
                   ->getResult();
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         $this->assertEquals('gblanco3', $data[0]->username);
405 405
         $this->assertEquals('gblanco4', $data[1]->username);
406 406
 
407
-        $data = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u')
407
+        $data = $this->_em->createQuery('SELECT u FROM '.CmsUser::class.' u')
408 408
                   ->setFirstResult(3)
409 409
                   ->setMaxResults(2)
410 410
                   ->getScalarResult();
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
         $this->_em->flush();
499 499
         $this->_em->clear();
500 500
 
501
-        $query = $this->_em->createQuery("select u from " . CmsUser::class . " u where u.username = 'gblanco'");
501
+        $query = $this->_em->createQuery("select u from ".CmsUser::class." u where u.username = 'gblanco'");
502 502
 
503 503
         $fetchedUser = $query->getOneOrNullResult();
504 504
         $this->assertInstanceOf(CmsUser::class, $fetchedUser);
505 505
         $this->assertEquals('gblanco', $fetchedUser->username);
506 506
 
507
-        $query = $this->_em->createQuery("select u.username from " . CmsUser::class . " u where u.username = 'gblanco'");
507
+        $query = $this->_em->createQuery("select u.username from ".CmsUser::class." u where u.username = 'gblanco'");
508 508
         $fetchedUsername = $query->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR);
509 509
         $this->assertEquals('gblanco', $fetchedUsername);
510 510
     }
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -173,6 +173,10 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public $phones;
175 175
 
176
+    /**
177
+     * @param string $email
178
+     * @param string $name
179
+     */
176 180
     public function __construct($email, $name, array $numbers = [])
177 181
     {
178 182
         $this->name   = $name;
@@ -208,6 +212,9 @@  discard block
 block discarded – undo
208 212
      */
209 213
     public $user;
210 214
 
215
+    /**
216
+     * @param DDC1335User $user
217
+     */
211 218
     public function __construct($user, $number)
212 219
     {
213 220
         $this->user     = $user;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
                 ]
19 19
             );
20 20
             $this->loadFixture();
21
-        } catch(\Exception $e) {
21
+        } catch (\Exception $e) {
22 22
         }
23 23
     }
24 24
 
25 25
 
26 26
     public function testDql()
27 27
     {
28
-        $dql      = 'SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.id';
28
+        $dql      = 'SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.id';
29 29
         $query    = $this->_em->createQuery($dql);
30 30
         $result   = $query->getResult();
31 31
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $this->assertArrayHasKey(2, $result);
35 35
         $this->assertArrayHasKey(3, $result);
36 36
 
37
-        $dql      = 'SELECT u, p FROM '.__NAMESPACE__ . '\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id';
37
+        $dql      = 'SELECT u, p FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id';
38 38
         $query    = $this->_em->createQuery($dql);
39 39
         $result   = $query->getResult();
40 40
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $this->assertArrayHasKey(1, $result);
77 77
         $this->assertArrayHasKey(2, $result);
78 78
         $this->assertArrayHasKey(3, $result);
79
-        $this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.id', $dql);
79
+        $this->assertEquals('SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.id', $dql);
80 80
     }
81 81
 
82 82
     public function testIndexByUnique()
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
         $this->assertArrayHasKey('[email protected]', $result);
92 92
         $this->assertArrayHasKey('[email protected]', $result);
93 93
         $this->assertArrayHasKey('[email protected]', $result);
94
-        $this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1335User u INDEX BY u.email', $dql);
94
+        $this->assertEquals('SELECT u FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email', $dql);
95 95
     }
96 96
 
97 97
     public function  testIndexWithJoin()
98 98
     {
99 99
         $builder = $this->_em->createQueryBuilder();
100
-        $builder->select('u','p')
100
+        $builder->select('u', 'p')
101 101
                 ->from(DDC1335User::class, 'u', 'u.email')
102 102
                 ->join('u.phones', 'p', null, null, 'p.id');
103 103
 
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
         $this->assertArrayHasKey(8, $result['[email protected]']->phones->toArray());
126 126
         $this->assertArrayHasKey(9, $result['[email protected]']->phones->toArray());
127 127
 
128
-        $this->assertEquals('SELECT u, p FROM '.__NAMESPACE__ . '\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id', $dql);
128
+        $this->assertEquals('SELECT u, p FROM '.__NAMESPACE__.'\DDC1335User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id', $dql);
129 129
     }
130 130
 
131 131
     private function loadFixture()
132 132
     {
133
-        $p1 = ['11 xxxx-xxxx','11 yyyy-yyyy','11 zzzz-zzzz'];
134
-        $p2 = ['22 xxxx-xxxx','22 yyyy-yyyy','22 zzzz-zzzz'];
135
-        $p3 = ['33 xxxx-xxxx','33 yyyy-yyyy','33 zzzz-zzzz'];
133
+        $p1 = ['11 xxxx-xxxx', '11 yyyy-yyyy', '11 zzzz-zzzz'];
134
+        $p2 = ['22 xxxx-xxxx', '22 yyyy-yyyy', '22 zzzz-zzzz'];
135
+        $p3 = ['33 xxxx-xxxx', '33 yyyy-yyyy', '33 zzzz-zzzz'];
136 136
 
137
-        $u1 = new DDC1335User("[email protected]", "Foo",$p1);
138
-        $u2 = new DDC1335User("[email protected]", "Bar",$p2);
139
-        $u3 = new DDC1335User("[email protected]", "Foo Bar",$p3);
137
+        $u1 = new DDC1335User("[email protected]", "Foo", $p1);
138
+        $u2 = new DDC1335User("[email protected]", "Bar", $p2);
139
+        $u3 = new DDC1335User("[email protected]", "Foo Bar", $p3);
140 140
 
141 141
         $this->_em->persist($u1);
142 142
         $this->_em->persist($u2);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         $this->phones = new \Doctrine\Common\Collections\ArrayCollection();
181 181
 
182 182
         foreach ($numbers as $number) {
183
-            $this->phones->add(new DDC1335Phone($this,$number));
183
+            $this->phones->add(new DDC1335Phone($this, $number));
184 184
         }
185 185
     }
186 186
 }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
     public function __construct($user, $number)
212 212
     {
213
-        $this->user     = $user;
214
-        $this->numericalValue   = $number;
213
+        $this->user = $user;
214
+        $this->numericalValue = $number;
215 215
     }
216 216
 }
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -119,6 +119,10 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public $driverRides;
121 121
 
122
+    /**
123
+     * @param integer $id
124
+     * @param string $name
125
+     */
122 126
     public function __construct($id, $name)
123 127
     {
124 128
         $this->driverRides = new ArrayCollection();
@@ -181,6 +185,10 @@  discard block
 block discarded – undo
181 185
      */
182 186
     public $carRides;
183 187
 
188
+    /**
189
+     * @param string $brand
190
+     * @param string $model
191
+     */
184 192
     public function __construct($brand, $model)
185 193
     {
186 194
         $this->carRides = new ArrayCollection();
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php 3 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,6 +227,9 @@  discard block
 block discarded – undo
227 227
         $this->assertEquals([], $metadata);
228 228
     }
229 229
 
230
+    /**
231
+     * @param \PHPUnit_Framework_MockObject_MockObject $conn
232
+     */
230 233
     protected function _createEntityManager($metadataDriver, $conn = null)
231 234
     {
232 235
         $driverMock = new DriverMock();
@@ -255,7 +258,6 @@  discard block
 block discarded – undo
255 258
     }
256 259
 
257 260
     /**
258
-     * @param string $class
259 261
      * @return ClassMetadata
260 262
      */
261 263
     protected function _createValidClassMetadata()
@@ -469,6 +471,10 @@  discard block
 block discarded – undo
469 471
         return $this->mockMetadata[$className];
470 472
     }
471 473
 
474
+    /**
475
+     * @param string $className
476
+     * @param ClassMetadata $metadata
477
+     */
472 478
     public function setMetadataForClass($className, $metadata)
473 479
     {
474 480
         $this->mockMetadata[$className] = $metadata;
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
         $cmf = new ClassMetadataFactory();
132 132
         $driver = $this->createMock(MappingDriver::class);
133 133
         $driver->expects($this->at(0))
134
-               ->method('isTransient')
135
-               ->with($this->equalTo(CmsUser::class))
136
-               ->will($this->returnValue(true));
134
+                ->method('isTransient')
135
+                ->with($this->equalTo(CmsUser::class))
136
+                ->will($this->returnValue(true));
137 137
         $driver->expects($this->at(1))
138
-               ->method('isTransient')
139
-               ->with($this->equalTo(CmsArticle::class))
140
-               ->will($this->returnValue(false));
138
+                ->method('isTransient')
139
+                ->with($this->equalTo(CmsArticle::class))
140
+                ->will($this->returnValue(false));
141 141
 
142 142
         $em = $this->_createEntityManager($driver);
143 143
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
         $cmf = new ClassMetadataFactory();
154 154
         $driver = $this->createMock(MappingDriver::class);
155 155
         $driver->expects($this->at(0))
156
-               ->method('isTransient')
157
-               ->with($this->equalTo(CmsUser::class))
158
-               ->will($this->returnValue(true));
156
+                ->method('isTransient')
157
+                ->with($this->equalTo(CmsUser::class))
158
+                ->will($this->returnValue(true));
159 159
         $driver->expects($this->at(1))
160
-               ->method('isTransient')
161
-               ->with($this->equalTo(CmsArticle::class))
162
-               ->will($this->returnValue(false));
160
+                ->method('isTransient')
161
+                ->with($this->equalTo(CmsArticle::class))
162
+                ->will($this->returnValue(false));
163 163
 
164 164
         $em = $this->_createEntityManager($driver);
165 165
         $em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS');
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
     }
284 284
 
285 285
     /**
286
-    * @group DDC-1845
287
-    */
286
+     * @group DDC-1845
287
+     */
288 288
     public function testQuoteMetadata()
289 289
     {
290 290
         $cmf    = new ClassMetadataFactory();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
     {
109 109
         require_once __DIR__."/../../Models/Global/GlobalNamespaceModel.php";
110 110
 
111
-        $metadataDriver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Global/']);
111
+        $metadataDriver = $this->createAnnotationDriver([__DIR__.'/../../Models/Global/']);
112 112
 
113 113
         $entityManager = $this->_createEntityManager($metadataDriver);
114 114
 
115 115
         $mf = $entityManager->getMetadataFactory();
116 116
         $m1 = $mf->getMetadataFor(DoctrineGlobal_Article::class);
117 117
         $h1 = $mf->hasMetadataFor(DoctrineGlobal_Article::class);
118
-        $h2 = $mf->hasMetadataFor('\\' . DoctrineGlobal_Article::class);
119
-        $m2 = $mf->getMetadataFor('\\' . DoctrineGlobal_Article::class);
118
+        $h2 = $mf->hasMetadataFor('\\'.DoctrineGlobal_Article::class);
119
+        $m2 = $mf->getMetadataFor('\\'.DoctrineGlobal_Article::class);
120 120
 
121 121
         $this->assertNotSame($m1, $m2);
122 122
         $this->assertFalse($h2);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     public function testAddDefaultDiscriminatorMap()
172 172
     {
173 173
         $cmf = new ClassMetadataFactory();
174
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/JoinedInheritanceType/']);
174
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/JoinedInheritanceType/']);
175 175
         $em = $this->_createEntityManager($driver);
176 176
         $cmf->setEntityManager($em);
177 177
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         // DDC-3551
213 213
         $conn = $this->createMock(Connection::class);
214
-        $mockDriver    = new MetadataDriverMock();
214
+        $mockDriver = new MetadataDriverMock();
215 215
         $em = $this->_createEntityManager($mockDriver, $conn);
216 216
 
217 217
         $conn->expects($this->any())
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $driverMock = new DriverMock();
233 233
         $config = new Configuration();
234
-        $config->setProxyDir(__DIR__ . '/../../Proxies');
234
+        $config->setProxyDir(__DIR__.'/../../Proxies');
235 235
         $config->setProxyNamespace('Doctrine\Tests\Proxies');
236 236
         $eventManager = new EventManager();
237
-        if (!$conn) {
237
+        if ( ! $conn) {
238 238
             $conn = new ConnectionMock([], $driverMock, $config, $eventManager);
239 239
         }
240 240
         $config->setMetadataDriverImpl($metadataDriver);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     public function testQuoteMetadata()
289 289
     {
290 290
         $cmf    = new ClassMetadataFactory();
291
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Quote/']);
291
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/Quote/']);
292 292
         $em     = $this->_createEntityManager($driver);
293 293
         $cmf->setEntityManager($em);
294 294
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         $listener
384 384
             ->expects($this->any())
385 385
             ->method('onClassMetadataNotFound')
386
-            ->will($this->returnCallback(function (OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) {
386
+            ->will($this->returnCallback(function(OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) {
387 387
                 $test->assertNull($args->getFoundMetadata());
388 388
                 $test->assertSame('Foo', $args->getClassName());
389 389
                 $test->assertSame($em, $args->getObjectManager());
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     public function testInheritsIdGeneratorMappingFromEmbeddable()
444 444
     {
445 445
         $cmf = new ClassMetadataFactory();
446
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/DDC4006/']);
446
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/DDC4006/']);
447 447
         $em = $this->_createEntityManager($driver);
448 448
         $cmf->setEntityManager($em);
449 449
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Mapping/ReflectionEmbeddedPropertyTest.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Doctrine\Instantiator\Instantiator;
6 6
 use Doctrine\ORM\Mapping\ReflectionEmbeddedProperty;
7 7
 use Doctrine\Tests\Models\Generic\BooleanModel;
8
-use Doctrine\Tests\Models\Mapping\Entity;
9 8
 use Doctrine\Tests\Models\Reflection\AbstractEmbeddable;
10 9
 use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass;
11 10
 use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable;
Please login to merge, or discard this patch.
Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Doctrine\DBAL\Types\Type as DBALType;
8 8
 use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
9 9
 use Doctrine\Tests\Models\CustomType\CustomTypeChild;
10
-use Doctrine\Tests\Models\CustomType\CustomTypeFriend;
11 10
 use Doctrine\Tests\Models\CustomType\CustomTypeParent;
12 11
 use Doctrine\Tests\Models\Generic\NonAlphaColumnsEntity;
13 12
 use Doctrine\Tests\OrmTestCase;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
         $method = new \ReflectionMethod($this->_persister, 'getSelectConditionSQL');
85 85
         $method->setAccessible(true);
86 86
 
87
-        $sql = $method->invoke($this->_persister,  ['customInteger' => 1, 'child' => 1]);
87
+        $sql = $method->invoke($this->_persister, ['customInteger' => 1, 'child' => 1]);
88 88
 
89 89
         $this->assertEquals('t0.customInteger = ABS(?) AND t0.child_id = ?', $sql);
90 90
     }
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -38,6 +38,10 @@
 block discarded – undo
38 38
         return $query->getSql();
39 39
     }
40 40
 
41
+    /**
42
+     * @param string $dqlToBeTested
43
+     * @param string $sqlToBeConfirmed
44
+     */
41 45
     public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed, $treeWalkers = [], $outputWalker = null)
42 46
     {
43 47
         try {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         try {
44 44
             $this->assertEquals($sqlToBeConfirmed, $this->generateSql($dqlToBeTested, $treeWalkers, $outputWalker));
45 45
         } catch (\Exception $e) {
46
-            $this->fail($e->getMessage() . ' at "' . $e->getFile() . '" on line ' . $e->getLine());
46
+            $this->fail($e->getMessage().' at "'.$e->getFile().'" on line '.$e->getLine());
47 47
         }
48 48
     }
49 49
 
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
     {
202 202
         $rangeVariableDecl       = $identificationVariableDecl->rangeVariableDeclaration;
203 203
         $joinAssocPathExpression = new Query\AST\JoinAssociationPathExpression($rangeVariableDecl->aliasIdentificationVariable, 'address');
204
-        $joinAssocDeclaration    = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable . 'a', null);
204
+        $joinAssocDeclaration    = new Query\AST\JoinAssociationDeclaration($joinAssocPathExpression, $rangeVariableDecl->aliasIdentificationVariable.'a', null);
205 205
         $join                    = new Query\AST\Join(Query\AST\Join::JOIN_TYPE_LEFT, $joinAssocDeclaration);
206
-        $selectExpression        = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable . 'a', null, false);
206
+        $selectExpression        = new Query\AST\SelectExpression($rangeVariableDecl->aliasIdentificationVariable.'a', null, false);
207 207
 
208 208
         $identificationVariableDecl->joins[]                = $join;
209 209
         $selectStatement->selectClause->selectExpressions[] = $selectExpression;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $userMetadata    = $entityManager->getClassMetadata(CmsUser::class);
213 213
         $addressMetadata = $entityManager->getClassMetadata(CmsAddress::class);
214 214
 
215
-        $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable . 'a',
215
+        $this->setQueryComponent($rangeVariableDecl->aliasIdentificationVariable.'a',
216 216
             [
217 217
                 'metadata'     => $addressMetadata,
218 218
                 'parent'       => $rangeVariableDecl->aliasIdentificationVariable,
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -43,6 +43,10 @@
 block discarded – undo
43 43
         $this->_em = $this->_getTestEntityManager();
44 44
     }
45 45
 
46
+    /**
47
+     * @param string $dqlToBeTested
48
+     * @param string $sqlToBeConfirmed
49
+     */
46 50
     public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed)
47 51
     {
48 52
         try {
Please login to merge, or discard this patch.