Skip to content

Commit 390f586

Browse files
authored
Improved support for Codeception 5/PHP 8 (#55)
1 parent bb3cdf1 commit 390f586

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
/tests export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5-
/Robofile.php export-ignore
65
/*.md export-ignore
76
/*.yml export-ignore

composer.json

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
{
22
"name": "codeception/module-doctrine2",
33
"description": "Doctrine2 module for Codeception",
4-
"keywords": [ "codeception", "doctrine2" ],
5-
"homepage": "https://codeception.com/",
6-
"type": "library",
74
"license": "MIT",
5+
"type": "library",
6+
"keywords": [
7+
"codeception",
8+
"doctrine2"
9+
],
810
"authors": [
911
{
10-
"name":"Michael Bodnarchuk"
12+
"name": "Michael Bodnarchuk"
1113
},
1214
{
13-
"name":"Alex Kunin"
15+
"name": "Alex Kunin"
1416
}
1517
],
16-
"minimum-stability": "dev",
18+
"homepage": "https://codeception.com/",
1719
"require": {
1820
"php": "^8.0",
19-
"ext-pdo": "*",
2021
"ext-json": "*",
21-
"codeception/codeception": "dev-5.0-interfaces as 5.0.x-dev"
22+
"ext-pdo": "*",
23+
"codeception/codeception": "dev-5.0-interfaces as 5.0.0"
2224
},
2325
"require-dev": {
2426
"codeception/stub": "^4.0",
@@ -27,10 +29,16 @@
2729
"doctrine/orm": "^2.10",
2830
"phpstan/phpstan": "^1.0",
2931
"ramsey/uuid-doctrine": "^1.6",
30-
"symfony/cache": "^4.4 | ^5.4 | ^6.0"
32+
"symfony/cache": "^4.4 || ^5.4 || ^6.0"
3133
},
34+
"conflict": {
35+
"codeception/codeception": "<5.0"
36+
},
37+
"minimum-stability": "dev",
3238
"autoload": {
33-
"classmap": [ "src/" ]
39+
"classmap": [
40+
"src/"
41+
]
3442
},
3543
"config": {
3644
"classmap-authoritative": true,

phpstan-baseline.neon

Whitespace-only changes.

phpstan.neon

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
includes:
2-
- phpstan-baseline.neon
3-
41
parameters:
52
level: 6
63
paths:
@@ -12,7 +9,7 @@ parameters:
129
- tests/data/doctrine2_fixtures/TestFixture2.php
1310
- tests/_support/UnitTester.php
1411
checkMissingIterableValueType: false
15-
reportUnmatchedIgnoredErrors: false
12+
reportUnmatchedIgnoredErrors: true
1613
ignoreErrors:
1714
- path: tests/
1815
message: '#Property \S+ is never read, only written#'

src/Codeception/Module/Doctrine2.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@
138138
*/
139139
class Doctrine2 extends CodeceptionModule implements DependsOnModule, DataMapper
140140
{
141-
142141
private ?DoctrineProvider $dependentModule = null;
143142

143+
/**
144+
* @var array<string, mixed>
145+
*/
144146
protected array $config = [
145147
'cleanup' => true,
146148
'connection_callback' => false,
@@ -908,7 +910,7 @@ public function grabFromRepository(string $entity, string $field, array $params
908910
* $users = $I->grabEntitiesFromRepository(User::class, ['name' => 'davert']);
909911
* ```
910912
*
911-
* @template T
913+
* @template T of object
912914
* @param class-string<T> $entity
913915
* @param array $params . For `IS NULL`, use `['field' => null]`
914916
* @return list<T>
@@ -938,7 +940,7 @@ public function grabEntitiesFromRepository(string $entity, array $params = []):
938940
* $user = $I->grabEntityFromRepository(User::class, ['id' => '1234']);
939941
* ```
940942
*
941-
* @template T
943+
* @template T of object
942944
* @param class-string<T> $entity
943945
* @param array $params . For `IS NULL`, use `['field' => null]`
944946
* @return T
@@ -1006,7 +1008,7 @@ private function debugEntityCreation(object $instance, $pks): void
10061008
$message = get_class($instance) . ' entity created with ';
10071009

10081010
if (!is_array($pks)) {
1009-
$pks = [$pks];
1011+
$pks = [$pks];
10101012
$message .= 'primary key ';
10111013
} else {
10121014
$message .= 'composite primary key of ';
@@ -1023,10 +1025,7 @@ private function debugEntityCreation(object $instance, $pks): void
10231025
$this->debug(trim($message, ' ,'));
10241026
}
10251027

1026-
/**
1027-
* @param mixed $pk
1028-
*/
1029-
private function isDoctrineEntity($pk): bool
1028+
private function isDoctrineEntity(mixed $pk): bool
10301029
{
10311030
$isEntity = is_object($pk);
10321031

src/Codeception/Util/ReflectionPropertyAccessor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
class ReflectionPropertyAccessor
1717
{
1818
/**
19-
* @return mixed
2019
* @throws ReflectionException
2120
*/
22-
public function getProperty(object $obj, string $field)
21+
public function getProperty(object $obj, string $field): mixed
2322
{
2423
$class = get_class($obj);
2524
do {

0 commit comments

Comments
 (0)