-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Type/Doctrine/Descriptors/Symfony/UuidTypeDescriptor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type\Doctrine\Descriptors\Symfony; | ||
|
||
use PHPStan\Type\Doctrine\Descriptors\DoctrineTypeDescriptor; | ||
use PHPStan\Type\ObjectType; | ||
use PHPStan\Type\StringType; | ||
use PHPStan\Type\Type; | ||
use Symfony\Bridge\Doctrine\Types\UuidType; | ||
use Symfony\Component\Uid\Uuid; | ||
|
||
class UuidTypeDescriptor implements DoctrineTypeDescriptor | ||
{ | ||
|
||
public function getType(): string | ||
{ | ||
return UuidType::class; | ||
} | ||
|
||
public function getWritableToPropertyType(): Type | ||
{ | ||
return new ObjectType(Uuid::class); | ||
} | ||
|
||
public function getWritableToDatabaseType(): Type | ||
{ | ||
return new ObjectType(Uuid::class); | ||
} | ||
|
||
public function getDatabaseInternalType(): Type | ||
{ | ||
return new StringType(); | ||
} | ||
|
||
} |