@@ -214,7 +214,7 @@ public function _parts(): array
214
214
*/
215
215
protected $ persistentServices = [];
216
216
217
- public function _initialize ()
217
+ public function _initialize (): void
218
218
{
219
219
$ this ->initializeSymfonyCache ();
220
220
$ this ->kernelClass = $ this ->getKernelClass ();
@@ -235,7 +235,7 @@ public function _initialize()
235
235
/**
236
236
* Require Symfony's bootstrap.php.cache
237
237
*/
238
- private function initializeSymfonyCache ()
238
+ private function initializeSymfonyCache (): void
239
239
{
240
240
$ cache = Configuration::projectDir () . $ this ->config ['var_path ' ] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache ' ;
241
241
@@ -249,7 +249,7 @@ private function initializeSymfonyCache()
249
249
*
250
250
* @param TestInterface $test
251
251
*/
252
- public function _before (TestInterface $ test )
252
+ public function _before (TestInterface $ test ): void
253
253
{
254
254
$ this ->persistentServices = array_merge ($ this ->persistentServices , $ this ->permanentServices );
255
255
$ this ->client = new SymfonyConnector ($ this ->kernel , $ this ->persistentServices , $ this ->config ['rebootable_client ' ]);
@@ -260,15 +260,15 @@ public function _before(TestInterface $test)
260
260
*
261
261
* @param TestInterface $test
262
262
*/
263
- public function _after (TestInterface $ test )
263
+ public function _after (TestInterface $ test ): void
264
264
{
265
265
foreach (array_keys ($ this ->permanentServices ) as $ serviceName ) {
266
266
$ this ->permanentServices [$ serviceName ] = $ this ->grabService ($ serviceName );
267
267
}
268
268
parent ::_after ($ test );
269
269
}
270
270
271
- protected function onReconfigure ($ settings = [])
271
+ protected function onReconfigure ($ settings = []): void
272
272
{
273
273
274
274
parent ::_beforeSuite ($ settings );
@@ -307,7 +307,7 @@ public function _getEntityManager()
307
307
*
308
308
* @return ContainerInterface|mixed
309
309
*/
310
- public function _getContainer ()
310
+ public function _getContainer (): ContainerInterface
311
311
{
312
312
$ container = $ this ->kernel ->getContainer ();
313
313
@@ -337,18 +337,18 @@ protected function getKernelClass(): string
337
337
throw new ModuleRequireException (
338
338
self ::class,
339
339
"Can't load Kernel from $ path. \n"
340
- . " Directory does not exists. Use `app_path` parameter to provide valid application path "
340
+ . ' Directory does not exists. Use `app_path` parameter to provide valid application path '
341
341
);
342
342
}
343
343
344
344
$ finder = new Finder ();
345
345
$ finder ->name ('*Kernel.php ' )->depth ('0 ' )->in ($ path );
346
346
$ results = iterator_to_array ($ finder );
347
- if (count ( $ results) === 0 ) {
347
+ if ($ results === [] ) {
348
348
throw new ModuleRequireException (
349
349
self ::class,
350
350
"File with Kernel class was not found at $ path. "
351
- . " Specify directory where file with Kernel class for your application is located with `app_path` parameter. "
351
+ . ' Specify directory where file with Kernel class for your application is located with `app_path` parameter. '
352
352
);
353
353
}
354
354
@@ -376,7 +376,7 @@ protected function getKernelClass(): string
376
376
throw new ModuleRequireException (
377
377
self ::class,
378
378
"Kernel class was not found in $ file. "
379
- . " Specify directory where file with Kernel class for your application is located with `app_path` parameter. "
379
+ . ' Specify directory where file with Kernel class for your application is located with `app_path` parameter. '
380
380
);
381
381
}
382
382
@@ -389,7 +389,7 @@ public function persistService(string $serviceName): void
389
389
{
390
390
$ service = $ this ->grabService ($ serviceName );
391
391
$ this ->persistentServices [$ serviceName ] = $ service ;
392
- if ($ this ->client ) {
392
+ if ($ this ->client instanceof SymfonyConnector ) {
393
393
$ this ->client ->persistentServices [$ serviceName ] = $ service ;
394
394
}
395
395
}
@@ -405,7 +405,7 @@ public function persistPermanentService(string $serviceName): void
405
405
$ service = $ this ->grabService ($ serviceName );
406
406
$ this ->persistentServices [$ serviceName ] = $ service ;
407
407
$ this ->permanentServices [$ serviceName ] = $ service ;
408
- if ($ this ->client ) {
408
+ if ($ this ->client instanceof SymfonyConnector ) {
409
409
$ this ->client ->persistentServices [$ serviceName ] = $ service ;
410
410
}
411
411
}
@@ -423,7 +423,7 @@ public function unpersistService(string $serviceName): void
423
423
if (isset ($ this ->permanentServices [$ serviceName ])) {
424
424
unset($ this ->permanentServices [$ serviceName ]);
425
425
}
426
- if ($ this ->client && isset ($ this ->client ->persistentServices [$ serviceName ])) {
426
+ if ($ this ->client instanceof SymfonyConnector && isset ($ this ->client ->persistentServices [$ serviceName ])) {
427
427
unset($ this ->client ->persistentServices [$ serviceName ]);
428
428
}
429
429
}
@@ -452,7 +452,7 @@ public function amOnRoute(string $routeName, array $params = []): void
452
452
{
453
453
/** @var RouterInterface $router */
454
454
$ router = $ this ->grabService ('router ' );
455
- if (! $ router ->getRouteCollection ()->get ($ routeName )) {
455
+ if ($ router ->getRouteCollection ()->get ($ routeName ) === null ) {
456
456
$ this ->fail (sprintf ('Route with name "%s" does not exists. ' , $ routeName ));
457
457
}
458
458
$ url = $ router ->generate ($ routeName , $ params );
@@ -475,7 +475,7 @@ public function seeCurrentRouteIs(string $routeName, array $params = []): void
475
475
{
476
476
/** @var RouterInterface $router */
477
477
$ router = $ this ->grabService ('router ' );
478
- if (! $ router ->getRouteCollection ()->get ($ routeName )) {
478
+ if ($ router ->getRouteCollection ()->get ($ routeName ) === null ) {
479
479
$ this ->fail (sprintf ('Route with name "%s" does not exists. ' , $ routeName ));
480
480
}
481
481
@@ -506,7 +506,7 @@ public function seeInCurrentRoute(string $routeName): void
506
506
{
507
507
/** @var RouterInterface $router */
508
508
$ router = $ this ->grabService ('router ' );
509
- if (! $ router ->getRouteCollection ()->get ($ routeName )) {
509
+ if ($ router ->getRouteCollection ()->get ($ routeName ) === null ) {
510
510
$ this ->fail (sprintf ('Route with name "%s" does not exists. ' , $ routeName ));
511
511
}
512
512
@@ -834,7 +834,7 @@ protected function getInternalDomains(): array
834
834
*/
835
835
public function rebootClientKernel (): void
836
836
{
837
- if ($ this ->client ) {
837
+ if ($ this ->client instanceof SymfonyConnector ) {
838
838
$ this ->client ->rebootKernel ();
839
839
}
840
840
}
@@ -1076,7 +1076,7 @@ public function seeAuthentication(): void
1076
1076
1077
1077
$ user = $ security ->getUser ();
1078
1078
1079
- if (! $ user ) {
1079
+ if ($ user === null ) {
1080
1080
$ this ->fail ('There is no user in session ' );
1081
1081
}
1082
1082
@@ -1129,7 +1129,7 @@ public function seeRememberedAuthentication(): void
1129
1129
1130
1130
$ user = $ security ->getUser ();
1131
1131
1132
- if (! $ user ) {
1132
+ if ($ user === null ) {
1133
1133
$ this ->fail ('There is no user in session ' );
1134
1134
}
1135
1135
@@ -1172,14 +1172,14 @@ public function seeUserHasRole(string $role): void
1172
1172
1173
1173
$ user = $ security ->getUser ();
1174
1174
1175
- if (! $ user ) {
1175
+ if ($ user === null ) {
1176
1176
$ this ->fail ('There is no user in session ' );
1177
1177
}
1178
1178
1179
1179
$ this ->assertTrue (
1180
1180
$ security ->isGranted ($ role ),
1181
1181
sprintf (
1182
- " User %s has no role %s " ,
1182
+ ' User %s has no role %s ' ,
1183
1183
$ user ->getUsername (),
1184
1184
$ role
1185
1185
)
@@ -1373,7 +1373,8 @@ public function seeUserPasswordDoesNotNeedRehash(UserInterface $user = null): vo
1373
1373
if ($ user === null ) {
1374
1374
/** @var Security $security */
1375
1375
$ security = $ this ->grabService ('security.helper ' );
1376
- if (!$ user = $ security ->getUser ()) {
1376
+ $ user = $ security ->getUser ();
1377
+ if ($ user === null ) {
1377
1378
$ this ->fail ('No user found to validate ' );
1378
1379
}
1379
1380
}
0 commit comments