Skip to content

Commit bf36d98

Browse files
committed
Fix inconsistent PHP version requirements
1 parent ee7cb9c commit bf36d98

17 files changed

+60
-28
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
matrix:
99
php: [8.2, 8.3, 8.4]
1010
symfony: ["5.4.*", "6.4.*", "6.4wApi", "7.3.*"]
11+
env:
12+
only_sf_latest: &only_sf_latest ${{ matrix.symfony == '7.3.*' }}
1113

1214
steps:
1315
- name: Checkout code
@@ -17,7 +19,7 @@ jobs:
1719
uses: shivammathur/setup-php@v2
1820
with:
1921
php-version: ${{ matrix.php }}
20-
tools: composer:v2, phpstan
22+
tools: composer:v2
2123
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
2224
coverage: none
2325

@@ -79,8 +81,16 @@ jobs:
7981
composer update --prefer-dist --no-progress
8082
8183
- name: Run PHPStan (max)
82-
if: ${{ matrix.symfony == '7.2.*' }}
83-
run: phpstan analyse src --level=max --no-progress --error-format=github --memory-limit=1G
84+
if: *only_sf_latest
85+
run: composer phpstan
86+
87+
- name: Run PHP-CS-Fixer
88+
if: *only_sf_latest
89+
run: composer cs-check
90+
91+
- name: Run Composer Audit
92+
if: *only_sf_latest
93+
run: composer audit
8494

8595
- name: Validate Composer files
8696
run: composer validate --strict

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea/
22
/vendor/
33
/composer.lock
4-
/framework-tests
4+
/framework-tests
5+
/.php-cs-fixer.cache

composer.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"codeception/module-asserts": "^3.0",
3232
"codeception/module-doctrine": "^3.1",
3333
"doctrine/orm": "^3.5",
34+
"friendsofphp/php-cs-fixer": "^3.85",
35+
"phpstan/phpstan": "^2.1",
3436
"symfony/browser-kit": "^5.4 | ^6.4 | ^7.3",
3537
"symfony/cache": "^5.4 | ^6.4 | ^7.3",
3638
"symfony/config": "^5.4 | ^6.4 | ^7.3",
@@ -66,11 +68,17 @@
6668
"symfony/web-profiler-bundle": "Tool that gives information about the execution of requests"
6769
},
6870
"autoload": {
69-
"classmap": ["src/"]
71+
"psr-4": {
72+
"Codeception\\": "src/Codeception/"
73+
}
7074
},
7175
"config": {
72-
"classmap-authoritative": true,
7376
"sort-packages": true
7477
},
75-
"minimum-stability": "RC"
78+
"minimum-stability": "RC",
79+
"scripts": {
80+
"phpstan": "phpstan analyse src --level=max --memory-limit=1G",
81+
"cs-check": "php-cs-fixer fix src --dry-run --diff --using-cache=no",
82+
"cs-fix": "php-cs-fixer fix src --using-cache=no"
83+
}
7684
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A Codeception module for Symfony framework.
1010
## Requirements
1111

1212
* `Symfony` `5.4.x`, `6.4.x`, `7.3.x` or higher, as per the [Symfony supported versions](https://symfony.com/releases).
13-
* `PHP 8.1` or higher.
13+
* `PHP 8.2` or higher.
1414

1515
## Installation
1616

src/Codeception/Module/Symfony.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use Symfony\Component\Mailer\DataCollector\MessageDataCollector;
5555
use Symfony\Component\Translation\DataCollector\TranslationDataCollector;
5656
use Symfony\Component\VarDumper\Cloner\Data;
57+
5758
use function array_keys;
5859
use function array_map;
5960
use function array_unique;
@@ -64,6 +65,7 @@
6465
use function file_exists;
6566
use function implode;
6667
use function in_array;
68+
use function extension_loaded;
6769
use function ini_get;
6870
use function ini_set;
6971
use function is_object;
@@ -292,8 +294,7 @@ public function _getEntityManager(): EntityManagerInterface
292294
$this->persistPermanentService($emService);
293295
$container = $this->_getContainer();
294296
foreach (
295-
['doctrine', 'doctrine.orm.default_entity_manager', 'doctrine.dbal.default_connection']
296-
as $service
297+
['doctrine', 'doctrine.orm.default_entity_manager', 'doctrine.dbal.default_connection'] as $service
297298
) {
298299
if ($container->has($service)) {
299300
$this->persistPermanentService($service);
@@ -495,6 +496,10 @@ protected function getInternalDomains(): array
495496
*/
496497
private function setXdebugMaxNestingLevel(int $max): void
497498
{
499+
if (!extension_loaded('xdebug')) {
500+
return;
501+
}
502+
498503
if ((int) ini_get('xdebug.max_nesting_level') < $max) {
499504
ini_set('xdebug.max_nesting_level', (string) $max);
500505
}

src/Codeception/Module/Symfony/BrowserAssertionsTrait.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsSuccessful;
2020
use Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsUnprocessable;
2121
use Symfony\Component\HttpFoundation\Test\Constraint\ResponseStatusCodeSame;
22+
2223
use function sprintf;
2324

2425
trait BrowserAssertionsTrait
@@ -329,10 +330,7 @@ public function seePageRedirectsTo(string $page, string $redirectsTo): void
329330
$client->followRedirects(false);
330331
$this->amOnPage($page);
331332

332-
$this->assertTrue(
333-
$client->getResponse()->isRedirection(),
334-
'The response is not a redirection.'
335-
);
333+
$this->assertThatForResponse(new ResponseIsRedirected(), 'The response is not a redirection.');
336334

337335
$client->followRedirect();
338336
$this->seeInCurrentUrl($redirectsTo);

src/Codeception/Module/Symfony/ConsoleAssertionsTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ private function configureOptions(array $parameters): array
7878
$options['interactive'] = false;
7979
}
8080

81-
if (in_array('-vvv', $parameters, true)
82-
|| in_array('--verbose=3', $parameters, true)
81+
if (in_array('-vvv', $parameters, true)
82+
|| in_array('--verbose=3', $parameters, true)
8383
|| (isset($parameters['--verbose']) && $parameters['--verbose'] === 3)
8484
) {
8585
$options['verbosity'] = OutputInterface::VERBOSITY_DEBUG;
86-
} elseif (in_array('-vv', $parameters, true)
87-
|| in_array('--verbose=2', $parameters, true)
86+
} elseif (in_array('-vv', $parameters, true)
87+
|| in_array('--verbose=2', $parameters, true)
8888
|| (isset($parameters['--verbose']) && $parameters['--verbose'] === 2)
8989
) {
9090
$options['verbosity'] = OutputInterface::VERBOSITY_VERY_VERBOSE;
91-
} elseif (in_array('-v', $parameters, true)
92-
|| in_array('--verbose=1', $parameters, true)
93-
|| in_array('--verbose', $parameters, true)
91+
} elseif (in_array('-v', $parameters, true)
92+
|| in_array('--verbose=1', $parameters, true)
93+
|| in_array('--verbose', $parameters, true)
9494
|| (isset($parameters['--verbose']) && $parameters['--verbose'] === 1)
9595
) {
9696
$options['verbosity'] = OutputInterface::VERBOSITY_VERBOSE;

src/Codeception/Module/Symfony/DomCrawlerAssertionsTrait.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function assertCheckboxNotChecked(string $fieldName, string $message = ''
3939
$this->assertThatCrawler(
4040
new LogicalNot(
4141
new CrawlerSelectorExists("input[name=\"$fieldName\"]:checked")
42-
), $message
42+
),
43+
$message
4344
);
4445
}
4546

@@ -57,7 +58,8 @@ public function assertInputValueNotSame(string $fieldName, string $expectedValue
5758
$this->assertThatCrawler(
5859
new LogicalNot(
5960
new CrawlerSelectorAttributeValueSame("input[name=\"$fieldName\"]", 'value', $expectedValue)
60-
), $message
61+
),
62+
$message
6163
);
6264
}
6365

src/Codeception/Module/Symfony/EventsAssertionsTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PHPUnit\Framework\Assert;
88
use Symfony\Component\HttpKernel\DataCollector\EventDataCollector;
9+
910
use function array_column;
1011
use function array_merge;
1112
use function count;

src/Codeception/Module/Symfony/FormAssertionsTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Symfony\Component\Form\Extension\DataCollector\FormDataCollector;
88
use Symfony\Component\VarDumper\Cloner\Data;
9+
910
use function is_array;
1011
use function is_int;
1112
use function is_string;

0 commit comments

Comments
 (0)