Skip to content

Commit 5448ba0

Browse files
authored
Remove support for PHP 7.1 and PHP 7.2 (#76)
1 parent 1687f64 commit 5448ba0

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [7.1, 7.2, 7.3, 7.4, 8.0]
11+
php: [7.3, 7.4, 8.0]
1212
symfony: [3.4, 4.4, 5]
13-
exclude:
14-
- php: 7.1
15-
symfony: 5
1613

1714
steps:
1815
- name: Checkout code

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
],
1717
"minimum-stability": "RC",
1818
"require": {
19-
"php": ">=7.1.3 <9.0",
19+
"php": "^7.3 | ^8.0",
20+
"ext-json": "*",
2021
"codeception/lib-innerbrowser": "^1.3",
21-
"codeception/codeception": "^4.0",
22-
"ext-json": "*"
22+
"codeception/codeception": "^4.0"
2323
},
2424
"require-dev": {
2525
"codeception/module-asserts": "^1.3",

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ A Codeception module for Symfony framework.
44

55
[![Actions Status](https://github.com/Codeception/module-symfony/workflows/CI/badge.svg)](https://github.com/Codeception/module-symfony/actions)
66

7+
## Requirements
8+
9+
* `Symfony 3.4` or higher.
10+
* `PHP 7.3` or higher.
11+
712
## Installation
813

914
```

src/Codeception/Module/Symfony.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function _parts(): array
214214
*/
215215
protected $persistentServices = [];
216216

217-
public function _initialize()
217+
public function _initialize(): void
218218
{
219219
$this->initializeSymfonyCache();
220220
$this->kernelClass = $this->getKernelClass();
@@ -235,7 +235,7 @@ public function _initialize()
235235
/**
236236
* Require Symfony's bootstrap.php.cache
237237
*/
238-
private function initializeSymfonyCache()
238+
private function initializeSymfonyCache(): void
239239
{
240240
$cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache';
241241

@@ -249,7 +249,7 @@ private function initializeSymfonyCache()
249249
*
250250
* @param TestInterface $test
251251
*/
252-
public function _before(TestInterface $test)
252+
public function _before(TestInterface $test): void
253253
{
254254
$this->persistentServices = array_merge($this->persistentServices, $this->permanentServices);
255255
$this->client = new SymfonyConnector($this->kernel, $this->persistentServices, $this->config['rebootable_client']);
@@ -260,15 +260,15 @@ public function _before(TestInterface $test)
260260
*
261261
* @param TestInterface $test
262262
*/
263-
public function _after(TestInterface $test)
263+
public function _after(TestInterface $test): void
264264
{
265265
foreach (array_keys($this->permanentServices) as $serviceName) {
266266
$this->permanentServices[$serviceName] = $this->grabService($serviceName);
267267
}
268268
parent::_after($test);
269269
}
270270

271-
protected function onReconfigure($settings = [])
271+
protected function onReconfigure($settings = []): void
272272
{
273273

274274
parent::_beforeSuite($settings);
@@ -307,7 +307,7 @@ public function _getEntityManager()
307307
*
308308
* @return ContainerInterface|mixed
309309
*/
310-
public function _getContainer()
310+
public function _getContainer(): ContainerInterface
311311
{
312312
$container = $this->kernel->getContainer();
313313

@@ -337,18 +337,18 @@ protected function getKernelClass(): string
337337
throw new ModuleRequireException(
338338
self::class,
339339
"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'
341341
);
342342
}
343343

344344
$finder = new Finder();
345345
$finder->name('*Kernel.php')->depth('0')->in($path);
346346
$results = iterator_to_array($finder);
347-
if (count($results) === 0) {
347+
if ($results === []) {
348348
throw new ModuleRequireException(
349349
self::class,
350350
"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.'
352352
);
353353
}
354354

@@ -376,7 +376,7 @@ protected function getKernelClass(): string
376376
throw new ModuleRequireException(
377377
self::class,
378378
"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.'
380380
);
381381
}
382382

@@ -389,7 +389,7 @@ public function persistService(string $serviceName): void
389389
{
390390
$service = $this->grabService($serviceName);
391391
$this->persistentServices[$serviceName] = $service;
392-
if ($this->client) {
392+
if ($this->client instanceof SymfonyConnector) {
393393
$this->client->persistentServices[$serviceName] = $service;
394394
}
395395
}
@@ -405,7 +405,7 @@ public function persistPermanentService(string $serviceName): void
405405
$service = $this->grabService($serviceName);
406406
$this->persistentServices[$serviceName] = $service;
407407
$this->permanentServices[$serviceName] = $service;
408-
if ($this->client) {
408+
if ($this->client instanceof SymfonyConnector) {
409409
$this->client->persistentServices[$serviceName] = $service;
410410
}
411411
}
@@ -423,7 +423,7 @@ public function unpersistService(string $serviceName): void
423423
if (isset($this->permanentServices[$serviceName])) {
424424
unset($this->permanentServices[$serviceName]);
425425
}
426-
if ($this->client && isset($this->client->persistentServices[$serviceName])) {
426+
if ($this->client instanceof SymfonyConnector && isset($this->client->persistentServices[$serviceName])) {
427427
unset($this->client->persistentServices[$serviceName]);
428428
}
429429
}
@@ -452,7 +452,7 @@ public function amOnRoute(string $routeName, array $params = []): void
452452
{
453453
/** @var RouterInterface $router */
454454
$router = $this->grabService('router');
455-
if (!$router->getRouteCollection()->get($routeName)) {
455+
if ($router->getRouteCollection()->get($routeName) === null) {
456456
$this->fail(sprintf('Route with name "%s" does not exists.', $routeName));
457457
}
458458
$url = $router->generate($routeName, $params);
@@ -475,7 +475,7 @@ public function seeCurrentRouteIs(string $routeName, array $params = []): void
475475
{
476476
/** @var RouterInterface $router */
477477
$router = $this->grabService('router');
478-
if (!$router->getRouteCollection()->get($routeName)) {
478+
if ($router->getRouteCollection()->get($routeName) === null) {
479479
$this->fail(sprintf('Route with name "%s" does not exists.', $routeName));
480480
}
481481

@@ -506,7 +506,7 @@ public function seeInCurrentRoute(string $routeName): void
506506
{
507507
/** @var RouterInterface $router */
508508
$router = $this->grabService('router');
509-
if (!$router->getRouteCollection()->get($routeName)) {
509+
if ($router->getRouteCollection()->get($routeName) === null) {
510510
$this->fail(sprintf('Route with name "%s" does not exists.', $routeName));
511511
}
512512

@@ -834,7 +834,7 @@ protected function getInternalDomains(): array
834834
*/
835835
public function rebootClientKernel(): void
836836
{
837-
if ($this->client) {
837+
if ($this->client instanceof SymfonyConnector) {
838838
$this->client->rebootKernel();
839839
}
840840
}
@@ -1076,7 +1076,7 @@ public function seeAuthentication(): void
10761076

10771077
$user = $security->getUser();
10781078

1079-
if (!$user) {
1079+
if ($user === null) {
10801080
$this->fail('There is no user in session');
10811081
}
10821082

@@ -1129,7 +1129,7 @@ public function seeRememberedAuthentication(): void
11291129

11301130
$user = $security->getUser();
11311131

1132-
if (!$user) {
1132+
if ($user === null) {
11331133
$this->fail('There is no user in session');
11341134
}
11351135

@@ -1172,14 +1172,14 @@ public function seeUserHasRole(string $role): void
11721172

11731173
$user = $security->getUser();
11741174

1175-
if (!$user) {
1175+
if ($user === null) {
11761176
$this->fail('There is no user in session');
11771177
}
11781178

11791179
$this->assertTrue(
11801180
$security->isGranted($role),
11811181
sprintf(
1182-
"User %s has no role %s",
1182+
'User %s has no role %s',
11831183
$user->getUsername(),
11841184
$role
11851185
)
@@ -1373,7 +1373,8 @@ public function seeUserPasswordDoesNotNeedRehash(UserInterface $user = null): vo
13731373
if ($user === null) {
13741374
/** @var Security $security */
13751375
$security = $this->grabService('security.helper');
1376-
if (!$user = $security->getUser()) {
1376+
$user = $security->getUser();
1377+
if ($user === null) {
13771378
$this->fail('No user found to validate');
13781379
}
13791380
}

0 commit comments

Comments
 (0)