From bb1725242a86e1b65b41be21d764ae54d1942b6d Mon Sep 17 00:00:00 2001 From: Florian Guimier Date: Thu, 30 Apr 2026 17:46:58 +0200 Subject: [PATCH] IT9PE1-27795: Add SpanishNifType --- README.md | 1 + src/Doctrine/DBAL/Types/SpanishNifType.php | 21 +++++++++++++ .../DBAL/Types/SpanishNifTypeTest.php | 31 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/Doctrine/DBAL/Types/SpanishNifType.php create mode 100644 tests/Doctrine/DBAL/Types/SpanishNifTypeTest.php diff --git a/README.md b/README.md index 5cabd85..c550602 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This Symfony5 bundle provides the integration of [Symfony validation component]( - [PhoneMobile](/src/Doctrine/DBAL/Types/PhoneMobileType.php) - [Phone](/src/Doctrine/DBAL/Types/PhoneType.php) - [Postal](/src/Doctrine/DBAL/Types/PostalType.php) +- [SpanishNifType](/src/Doctrine/DBAL/Types/SpanishNifType.php) - [Timezone](/src/Doctrine/DBAL/Types/TimezoneType.php) It also supports nullable and non-nullable fields. diff --git a/src/Doctrine/DBAL/Types/SpanishNifType.php b/src/Doctrine/DBAL/Types/SpanishNifType.php new file mode 100644 index 0000000..9c13941 --- /dev/null +++ b/src/Doctrine/DBAL/Types/SpanishNifType.php @@ -0,0 +1,21 @@ +type->getName()); + } + + public function testGetSQLDeclaration(): void + { + $this->abstractPlatform + ->method('getVarcharTypeDeclarationSQL') + ->with(['length' => SpanishNifType::LENGTH]) + ->willReturn('VARCHAR'); + + self::assertSame('VARCHAR', $this->type->getSQLDeclaration([], $this->abstractPlatform)); + } +}