Skip to content

Commit

Permalink
Fixes after PHPStan update
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 24, 2024
1 parent d45a640 commit 674c9d4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/Type/Doctrine/Descriptors/SimpleArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;

class SimpleArrayType implements DoctrineTypeDescriptor
{
Expand All @@ -19,7 +20,7 @@ public function getType(): string

public function getWritableToPropertyType(): Type
{
return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), new StringType()));
return TypeCombinator::intersect(new ArrayType(new IntegerType(), new StringType()), new AccessoryArrayListType());
}

public function getWritableToDatabaseType(): Type
Expand Down
4 changes: 2 additions & 2 deletions src/Type/Doctrine/HydrationModeReturnTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public function getMethodReturnTypeForHydrationMode(
);
default:
if ($queryKeyType->isNull()->yes()) {
return AccessoryArrayListType::intersectWith(new ArrayType(
return TypeCombinator::intersect(new ArrayType(
new IntegerType(),
$queryResultType,
));
), new AccessoryArrayListType());
}
return new ArrayType(
$queryKeyType,
Expand Down
3 changes: 0 additions & 3 deletions tests/Platform/data/config.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
includes:
- ../../../extension.neon
parameters:
featureToggles:
listType: true
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public function test(Type $expectedType, string $dql, string $methodName, ?int $
*/
public static function getTestData(): iterable
{
AccessoryArrayListType::setListTypeEnabled(true);

yield 'getResult(object), full entity' => [
self::list(new ObjectType(Simple::class)),
'
Expand Down Expand Up @@ -305,7 +303,7 @@ private static function constantArray(array $elements): Type

private static function list(Type $values): Type
{
return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), $values));
return TypeCombinator::intersect(new ArrayType(new IntegerType(), $values), new AccessoryArrayListType());
}

private static function numericString(): Type
Expand Down
2 changes: 1 addition & 1 deletion tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ private function yieldConditionalDataset(): iterable
$this->constantArray([
[new ConstantStringType('stringEnumColumn'), new ObjectType(StringEnum::class)],
[new ConstantStringType('intEnumColumn'), new ObjectType(IntEnum::class)],
[new ConstantStringType('stringEnumListColumn'), AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), new ObjectType(StringEnum::class)))],
[new ConstantStringType('stringEnumListColumn'), TypeCombinator::intersect(new ArrayType(new IntegerType(), new ObjectType(StringEnum::class)), new AccessoryArrayListType())],
]),
'
SELECT e.stringEnumColumn, e.intEnumColumn, e.stringEnumListColumn
Expand Down
2 changes: 0 additions & 2 deletions tests/Type/Doctrine/data/QueryResult/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ includes:
parameters:
doctrine:
objectManagerLoader: entity-manager.php
featureToggles:
listType: true

0 comments on commit 674c9d4

Please sign in to comment.