Skip to content

Commit 0caac17

Browse files
authored
Merge pull request #58 from Codeception/3.0
3.0 to master
2 parents 701e7e4 + ab2846b commit 0caac17

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
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": "^5.0.0-alpha1"
22+
"ext-pdo": "*",
23+
"codeception/codeception": "^5.0.0-alpha2"
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#'

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A Doctrine 2 module for Codeception.
99

1010
## Requirements
1111

12-
* `PHP 7.4` or higher.
12+
* `PHP 8.0` or higher.
1313

1414
## Installation
1515

src/Codeception/Module/Doctrine2.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@
136136
*
137137
* Note that key is ignored, because actual field name is part of criteria and/or expression.
138138
*/
139-
140139
class Doctrine2 extends CodeceptionModule implements DependsOnModule, DataMapper
141140
{
142-
143141
private ?DoctrineProvider $dependentModule = null;
144142

145-
/** @var array */
146-
protected $config = [
143+
/**
144+
* @var array<string, mixed>
145+
*/
146+
protected array $config = [
147147
'cleanup' => true,
148148
'connection_callback' => false,
149149
'depends' => null,
@@ -516,7 +516,7 @@ public function haveInRepository($classNameOrInstance, array $data = [])
516516
private function instantiateAndPopulateEntity(string $className, array $data, array &$instances)
517517
{
518518
$rpa = new ReflectionPropertyAccessor();
519-
[$scalars,$relations] = $this->splitScalarsAndRelations($className, $data);
519+
[$scalars, $relations] = $this->splitScalarsAndRelations($className, $data);
520520
// Pass relations that are already objects to the constructor, too
521521
$properties = array_merge(
522522
$scalars,
@@ -881,11 +881,11 @@ protected function proceedSeeInRepository(string $entity, array $params = []): a
881881
* $email = $I->grabFromRepository(User::class, 'email', ['name' => 'davert']);
882882
* ```
883883
*
884-
* @version 1.1
885884
* @param class-string $entity
886885
* @param string $field
887886
* @param array $params
888887
* @return mixed
888+
* @version 1.1
889889
*/
890890
public function grabFromRepository(string $entity, string $field, array $params = [])
891891
{
@@ -910,9 +910,9 @@ public function grabFromRepository(string $entity, string $field, array $params
910910
* $users = $I->grabEntitiesFromRepository(User::class, ['name' => 'davert']);
911911
* ```
912912
*
913-
* @template T
913+
* @template T of object
914914
* @param class-string<T> $entity
915-
* @param array $params. For `IS NULL`, use `['field' => null]`
915+
* @param array $params . For `IS NULL`, use `['field' => null]`
916916
* @return list<T>
917917
* @version 1.1
918918
*/
@@ -940,9 +940,9 @@ public function grabEntitiesFromRepository(string $entity, array $params = []):
940940
* $user = $I->grabEntityFromRepository(User::class, ['id' => '1234']);
941941
* ```
942942
*
943-
* @template T
943+
* @template T of object
944944
* @param class-string<T> $entity
945-
* @param array $params. For `IS NULL`, use `['field' => null]`
945+
* @param array $params . For `IS NULL`, use `['field' => null]`
946946
* @return T
947947
* @version 1.1
948948
*/
@@ -1005,30 +1005,27 @@ public function _getEntityManager(): EntityManagerInterface
10051005
*/
10061006
private function debugEntityCreation(object $instance, $pks): void
10071007
{
1008-
$message = get_class($instance).' entity created with ';
1008+
$message = get_class($instance) . ' entity created with ';
10091009

10101010
if (!is_array($pks)) {
1011-
$pks = [$pks];
1011+
$pks = [$pks];
10121012
$message .= 'primary key ';
10131013
} else {
10141014
$message .= 'composite primary key of ';
10151015
}
10161016

10171017
foreach ($pks as $pk) {
10181018
if ($this->isDoctrineEntity($pk)) {
1019-
$message .= get_class($pk).': '.var_export($this->extractPrimaryKey($pk), true).', ';
1019+
$message .= get_class($pk) . ': ' . var_export($this->extractPrimaryKey($pk), true) . ', ';
10201020
} else {
1021-
$message .= var_export($pk, true).', ';
1021+
$message .= var_export($pk, true) . ', ';
10221022
}
10231023
}
10241024

10251025
$this->debug(trim($message, ' ,'));
10261026
}
10271027

1028-
/**
1029-
* @param mixed $pk
1030-
*/
1031-
private function isDoctrineEntity($pk): bool
1028+
private function isDoctrineEntity(mixed $pk): bool
10321029
{
10331030
$isEntity = is_object($pk);
10341031

src/Codeception/Util/ReflectionPropertyAccessor.php

Lines changed: 2 additions & 3 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 {
@@ -52,7 +51,7 @@ private function setPropertiesForClass(?object $obj, string $class, array $data)
5251
$constructorParameters[] = $data[$parameter->getName()];
5352
} else {
5453
throw new InvalidArgumentException(
55-
'Constructor parameter "'.$parameter->getName().'" missing'
54+
'Constructor parameter "' . $parameter->getName() . '" missing'
5655
);
5756
}
5857
}

0 commit comments

Comments
 (0)