Skip to content

Commit 227eb38

Browse files
authored
Merge pull request #104 from chives/dev
Allowed doctrine/dbal ^4.0 and prepare for doctrine/orm ^4.0
2 parents efd84ca + b42c959 commit 227eb38

17 files changed

Lines changed: 72 additions & 36 deletions

File tree

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,24 @@
4545
"codeception/module-rest": "^3.4",
4646
"codeception/module-symfony": "^3.4",
4747
"codeception/stub": "^4.1.3",
48-
"doctrine/dbal": "^3.0",
48+
"doctrine/dbal": "^3.0|^4.0",
4949
"doctrine/doctrine-bundle": "^2.7",
5050
"doctrine/orm": "^2.13|^3.0",
51-
"doctrine/persistence": "^3.0",
51+
"doctrine/persistence": "^3.0|^4.0",
5252
"guzzlehttp/psr7": "^2.0",
5353
"league/flysystem-aws-s3-v3": "^2.0|^3.10",
5454
"league/flysystem-memory": "^2.0|^3.3",
5555
"monolog/monolog": "^2.8",
5656
"nyholm/psr7": "^1.5",
5757
"oneup/flysystem-bundle": "^4.4",
58-
"phpstan/phpstan": "^1.10.19",
59-
"phpstan/phpstan-beberlei-assert": "^1.1",
60-
"phpstan/phpstan-doctrine": "^1.3.60",
61-
"phpstan/phpstan-phpunit": "^1.3",
58+
"phpstan/phpstan": "^2.1.46",
59+
"phpstan/phpstan-beberlei-assert": "^2.0",
60+
"phpstan/phpstan-doctrine": "^2.0",
61+
"phpstan/phpstan-phpunit": "^2.0",
6262
"phpunit/phpunit": "^10.5.21",
6363
"psr/clock": "^1.0",
6464
"psr/clock-implementation": "*",
65-
"squizlabs/php_codesniffer": "^3.7",
65+
"squizlabs/php_codesniffer": "^4.0",
6666
"symfony/clock": "^6.0|^7.0",
6767
"symfony/config": "^5.4|^6.0|^7.0",
6868
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
@@ -112,7 +112,8 @@
112112
},
113113
"extra": {
114114
"branch-alias": {
115-
"dev-master": "3.0-dev",
115+
"dev-master": "3.1-dev",
116+
"3.0": "3.0-dev",
116117
"2.1": "2.1-dev",
117118
"2.0": "2.0-dev",
118119
"1.x": "1.x-dev"

phpstan.neon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ includes:
44
- vendor/phpstan/phpstan-phpunit/extension.neon
55
parameters:
66
reportUnmatchedIgnoredErrors: false
7+
treatPhpDocTypesAsCertain: false
78
bootstrapFiles:
89
- '%currentWorkingDirectory%/vendor/codeception/codeception/autoload.php'
910
level: 8
@@ -18,6 +19,9 @@ parameters:
1819
- '%currentWorkingDirectory%/tests/unit/Entity/UnionTestEntity.php'
1920
- '%currentWorkingDirectory%/tests/unit/FileUnionPropertyConfigurationTest.php'
2021
ignoreErrors:
22+
-
23+
message: '#Parameter \#3 \$headers of class FSi\\Component\\Files\\DirectUpload\\Controller\\Response\\Params constructor expects array\<string, list\<string\>\|string\>, array\<array\<string\>\> given\.#'
24+
path: '%currentWorkingDirectory%/src/Integration/FlySystem/DirectUpload/S3Adapter.php'
2125
-
2226
message: '#Strict comparison using === between null and string will always evaluate to false\.#'
2327
path: '%currentWorkingDirectory%/src/Integration/Symfony/Form/Transformer/SymfonyFileToWebFileTransformer.php'
@@ -33,6 +37,18 @@ parameters:
3337
-
3438
message: '#PHPDoc tag \@param for parameter \$event contains generic type Doctrine\\Persistence\\Event\\LifecycleEventArgs<Doctrine\\Persistence\\ObjectManager> but class Doctrine\\Persistence\\Event\\LifecycleEventArgs is not generic\.#'
3539
path: '%currentWorkingDirectory%/src/Integration/Doctrine/ORM/EntityFileSubscriber.php'
40+
-
41+
message: '#(unknown class |invalid type )?Doctrine\\ORM\\Mapping\\EmbeddedClassMapping( not found)?#'
42+
path: '%currentWorkingDirectory%/src/Integration/Doctrine/ORM/EntityFileSubscriber.php'
43+
-
44+
message: '#(Result of && is always false\.|Strict comparison using === between true and false will always evaluate to false\.)#'
45+
path: '%currentWorkingDirectory%/src/Integration/Doctrine/ORM/EntityFileSubscriber.php'
46+
-
47+
message: '#(Result of && is always false\.|Strict comparison using === between true and true will always evaluate to true\.)#'
48+
path: '%currentWorkingDirectory%/src/Integration/Doctrine/ORM/EntityFileSubscriber.php'
49+
-
50+
identifier: 'trait.unused'
51+
path: '%currentWorkingDirectory%/src/Integration/Doctrine/ORM/ProxyTrait.php'
3652
-
3753
message: '#Method Tests\\FSi\\Module\\UploadModule::grabClient\(\) return type with generic class Symfony\\Component\\BrowserKit\\AbstractBrowser does not specify its types: TRequest, TResponse#'
3854
path: '%currentWorkingDirectory%/tests/_support/Module/UploadModule'

src/DirectUpload/Controller/DirectUploadController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ public function completeMultipart(ServerRequestInterface $request): ResponseInte
117117
$this->getAdapter($dto)->complete(
118118
$dto->getUploadId(),
119119
$dto->getKey(),
120-
array_map(static fn(array $partData): Part => Part::fromArray($partData), $dto->body['parts'] ?? [])
120+
array_values(
121+
array_map(
122+
static fn(array $partData): Part => Part::fromArray($partData),
123+
$dto->body['parts'] ?? []
124+
)
125+
)
121126
);
122127

123128
return $this->createJsonResponse([]);

src/FilePropertyConfiguration.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,7 @@ private function createPropertyReflection(string $entityClass, string $property)
172172
$checkedClass = $parentClass;
173173
}
174174

175-
$propertyReflection = new ReflectionProperty($checkedClass, $property);
176-
if (PHP_VERSION_ID < 80500) {
177-
$propertyReflection->setAccessible(true);
178-
}
179-
180-
return $propertyReflection;
175+
return new ReflectionProperty($checkedClass, $property);
181176
}
182177

183178
/**

src/FilePropertyConfigurationResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public function resolveFileProperty(string $entityClass, string $filePropertyNam
6363
) {
6464
throw new RuntimeException(sprintf(
6565
'There is no file configuration for property "%s" of entity class "%s"',
66-
$entityClass,
67-
$filePropertyName
66+
$filePropertyName,
67+
$entityClass
6868
));
6969
}
7070

src/Integration/Doctrine/ORM/EntityFileSubscriber.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\Event\PostFlushEventArgs;
1616
use Doctrine\ORM\Event\PreFlushEventArgs;
1717
use Doctrine\ORM\Mapping\ClassMetadata as ORMClassMetadata;
18+
use Doctrine\ORM\Mapping\EmbeddedClassMapping;
1819
use Doctrine\Persistence\Event\LifecycleEventArgs;
1920
use Doctrine\Persistence\Mapping\ClassMetadata;
2021
use Doctrine\Persistence\ObjectManager;
@@ -25,6 +26,7 @@
2526

2627
use function array_walk;
2728
use function get_class;
29+
use function is_array;
2830
use function method_exists;
2931

3032
final class EntityFileSubscriber
@@ -128,15 +130,27 @@ private function callIterativelyForObjectAndItsEmbbedables(
128130
array_walk(
129131
$metadata->embeddedClasses,
130132
function (
131-
array|ArrayAccess $configuration,
133+
EmbeddedClassMapping|array $embeddedClassMapping,
132134
string $property,
133135
callable $callable
134136
) use (
135137
$object,
136138
$manager,
137139
$metadata
138140
): void {
139-
if (null !== $configuration['declaredField'] || null !== $configuration['originalField']) {
141+
if (
142+
true === $embeddedClassMapping instanceof EmbeddedClassMapping
143+
&& (
144+
null !== $embeddedClassMapping->declaredField
145+
|| null !== $embeddedClassMapping->originalField
146+
)
147+
) {
148+
return;
149+
}
150+
if (
151+
null !== $embeddedClassMapping['declaredField']
152+
|| null !== $embeddedClassMapping['originalField']
153+
) {
140154
return;
141155
}
142156

src/Integration/FlySystem/DirectUpload/S3Adapter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ public function parts(string $uploadId, string $key): array
8383
]);
8484
$result = $this->client->execute($cmd);
8585

86-
return array_map(static fn(array $partData): Part => Part::fromArray($partData), $result->get('Parts'));
86+
return array_values(
87+
array_map(
88+
static fn(array $partData): Part => Part::fromArray($partData),
89+
$result->get('Parts')
90+
)
91+
);
8792
}
8893

8994
public function part(string $uploadId, string $key, int $number): UriInterface
@@ -145,7 +150,7 @@ public function getOptions(): array
145150
}
146151

147152
/**
148-
* @return array<string, string>>
153+
* @return array<string, string>
149154
*/
150155
private function getObjectOptions(string $key): array
151156
{

src/Integration/Symfony/DependencyInjection/CompilerPass/BuildDirectUploadAdaptersPass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public function process(ContainerBuilder $container): void
4242
$flySystemExtension = $container->getExtension('oneup_flysystem');
4343
Assertion::isInstanceOf($flySystemExtension, OneupFlysystemExtension::class);
4444
$flySystemConfiguration = $flySystemExtension->getConfiguration($flySystemConfigs, $container);
45-
Assertion::isInstanceOf($flySystemConfiguration, FlySystemConfiguration::class);
4645
$flySystemConfig = $processor->processConfiguration($flySystemConfiguration, $flySystemConfigs);
4746

4847
$filesConfigs = $container->getExtensionConfig('fsi_files');

src/Integration/Symfony/FilesBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function loadExternalBundlesServices(ContainerBuilder $container): void
5858
}
5959
}
6060

61-
public function getContainerExtension(): ?ExtensionInterface
61+
public function getContainerExtension(): ExtensionInterface
6262
{
6363
if (false === $this->extension instanceof FilesExtension) {
6464
$this->extension = new FilesExtension();

src/Integration/Symfony/Form/Transformer/CompoundWebFileTransformer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ public function __construct(string $fileField)
2929
$this->fileField = $fileField;
3030
}
3131

32-
public function transform(mixed $value): mixed
32+
/**
33+
* @return array<mixed>
34+
*/
35+
public function transform(mixed $value): array
3336
{
3437
if (null === $value) {
3538
return [];

0 commit comments

Comments
 (0)