File tree Expand file tree Collapse file tree 4 files changed +51
-3
lines changed Expand file tree Collapse file tree 4 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ parameters:
1010 paths:
1111 - src
1212 - tests
13+ excludePaths:
14+ analyse:
15+ - tests/Fixtures/Compat
1316 checkMissingCallableSignature: true
1417 checkUninitializedProperties: true
1518 checkTooWideReturnTypesInProtectedAndPublicMethods: true
@@ -29,6 +32,10 @@ parameters:
2932 identifier: 'identical.alwaysFalse'
3033 reportUnmatched: false
3134 path: 'src/EntityPreloader.php'
35+ -
36+ identifier: shipmonk.defaultMatchArmWithEnum
37+ reportUnmatched: false # only new dbal issue
38+ path: 'src/EntityPreloader.php'
3239 -
3340 message: '#Result of \|\| is always false#'
3441 identifier: 'booleanOr.alwaysFalse'
Original file line number Diff line number Diff line change @@ -457,14 +457,14 @@ private function loadEntitiesBy(
457457 return $ queryBuilder ->getQuery ()->getResult ();
458458 }
459459
460- private function deduceArrayParameterType (Type $ dbalType ): ? ArrayParameterType
460+ private function deduceArrayParameterType (Type $ dbalType ): ArrayParameterType | int | null // @phpstan-ignore return.unusedType (old dbal compat)
461461 {
462462 return match ($ dbalType ->getBindingType ()) {
463463 ParameterType::INTEGER => ArrayParameterType::INTEGER ,
464464 ParameterType::STRING => ArrayParameterType::STRING ,
465465 ParameterType::ASCII => ArrayParameterType::ASCII ,
466466 ParameterType::BINARY => ArrayParameterType::BINARY ,
467- default => null , // @phpstan-ignore shipmonk.defaultMatchArmWithEnum
467+ default => null ,
468468 };
469469 }
470470
Original file line number Diff line number Diff line change 66use Doctrine \DBAL \Platforms \AbstractPlatform ;
77use Doctrine \DBAL \Types \Type ;
88use LogicException ;
9+ use ShipMonkTests \DoctrineEntityPreloader \Fixtures \Compat \CompatibilityType ;
910
1011final class BinaryIdType extends Type
1112{
1213
14+ use CompatibilityType;
15+
1316 public const NAME = 'binary_id ' ;
1417
1518 public function convertToPHPValue (
@@ -60,7 +63,7 @@ public function getName(): string
6063 return self ::NAME ;
6164 }
6265
63- public function getBindingType (): ParameterType
66+ public function doGetBindingType (): ParameterType | int // @phpstan-ignore return.unusedType (old dbal compat)
6467 {
6568 return ParameterType::BINARY ;
6669 }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace ShipMonkTests \DoctrineEntityPreloader \Fixtures \Compat ;
4+
5+ use Doctrine \DBAL \ParameterType ;
6+ use function enum_exists ;
7+
8+ if (!enum_exists (ParameterType::class)) {
9+ trait CompatibilityType
10+ {
11+
12+ public function getBindingType (): int
13+ {
14+ return $ this ->doGetBindingType ();
15+ }
16+
17+ private function doGetBindingType (): int |ParameterType
18+ {
19+ return parent ::getBindingType ();
20+ }
21+
22+ }
23+ } else {
24+ trait CompatibilityType
25+ {
26+
27+ public function getBindingType (): ParameterType
28+ {
29+ return $ this ->doGetBindingType ();
30+ }
31+
32+ private function doGetBindingType (): int |ParameterType
33+ {
34+ return parent ::getBindingType ();
35+ }
36+
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments