From 18d8cf437d35b8842f025dab36a6f3515e578932 Mon Sep 17 00:00:00 2001 From: gam6itko Date: Mon, 16 May 2022 16:02:20 +0300 Subject: [PATCH 1/4] add smallInteger type to Column --- src/Annotation/Column.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Annotation/Column.php b/src/Annotation/Column.php index 7e534c20..fe27ffb5 100644 --- a/src/Annotation/Column.php +++ b/src/Annotation/Column.php @@ -37,7 +37,8 @@ final class Column * @param bool $castDefault */ public function __construct( - #[ExpectedValues(values: ['primary', 'bigPrimary', 'enum', 'boolean', 'integer', 'tinyInteger', 'bigInteger', + #[ExpectedValues(values: ['primary', 'bigPrimary', 'enum', 'boolean', + 'integer', 'tinyInteger', 'smallInteger', 'bigInteger', 'string', 'text', 'tinyText', 'longText', 'double', 'float', 'decimal', 'datetime', 'date', 'time', 'timestamp', 'binary', 'tinyBinary', 'longBinary', 'json', ])] From 2ae1915b15b4bec0f6b252c76d887ab938722077 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Mon, 16 Jan 2023 10:24:22 +0200 Subject: [PATCH 2/4] Fix test, add cycle/database dependency --- composer.json | 1 + tests/Annotated/Functional/Driver/Common/InvalidTest.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 693d0ba7..06c74246 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,7 @@ "require": { "php": ">=8.0", "spiral/tokenizer": "^2.8", + "cycle/database": "^2.3", "cycle/orm": "^2.0.0", "cycle/schema-builder": "^2.1.0", "doctrine/annotations": "^1.13", diff --git a/tests/Annotated/Functional/Driver/Common/InvalidTest.php b/tests/Annotated/Functional/Driver/Common/InvalidTest.php index 8a83f476..857b48f3 100644 --- a/tests/Annotated/Functional/Driver/Common/InvalidTest.php +++ b/tests/Annotated/Functional/Driver/Common/InvalidTest.php @@ -18,6 +18,7 @@ use Cycle\Schema\Generator\SyncTables; use Cycle\Schema\Generator\ValidateEntities; use Cycle\Schema\Registry; +use Spiral\Attributes\AnnotationReader; use Spiral\Attributes\ReaderInterface; use Spiral\Tokenizer\Config\TokenizerConfig; use Spiral\Tokenizer\Tokenizer; @@ -59,10 +60,12 @@ public function testInvalidRelation(ReaderInterface $reader): void */ public function testNotDefinedColumnTypeShouldThrowAnException(ReaderInterface $reader): void { + $message = $reader instanceof AnnotationReader + ? 'Too few arguments to function Cycle\Annotated\Annotation\Column::__construct(), 0 passed' + : 'Some of required arguments [`type`] is missed on `Cycle\Annotated\Tests\Fixtures\Fixtures4\User.id.`'; + $this->expectException(AnnotationException::class); - $this->expectErrorMessage( - 'Some of required arguments [`type`] is missed on `Cycle\Annotated\Tests\Fixtures\Fixtures4\User.id.`' - ); + $this->expectErrorMessage($message); $tokenizer = new Tokenizer(new TokenizerConfig([ 'directories' => [__DIR__ . '/../../../Fixtures/Fixtures4'], From b94de76caab2ad0228fd27a588be4ca0c7b9f817 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Mon, 16 Jan 2023 10:39:45 +0200 Subject: [PATCH 3/4] Fix indents --- composer.json | 58 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index 4c8541a2..758ebc56 100644 --- a/composer.json +++ b/composer.json @@ -1,32 +1,32 @@ { - "name": "cycle/annotated", - "type": "library", - "license": "MIT", - "description": "Cycle ORM Annotated Entities generator", - "minimum-stability": "dev", - "prefer-stable": true, - "require": { - "php": ">=8.0", - "cycle/orm": "^2.2.0", - "cycle/database": "^2.3", - "cycle/schema-builder": "^2.1.0", - "doctrine/annotations": "^1.13", - "spiral/attributes": "^2.8|^3.0", - "spiral/tokenizer": "^2.8|^3.0", - "doctrine/inflector": "^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.18" - }, - "autoload": { - "psr-4": { - "Cycle\\Annotated\\": "src/" + "name": "cycle/annotated", + "type": "library", + "license": "MIT", + "description": "Cycle ORM Annotated Entities generator", + "minimum-stability": "dev", + "prefer-stable": true, + "require": { + "php": ">=8.0", + "cycle/orm": "^2.2.0", + "cycle/database": "^2.3", + "cycle/schema-builder": "^2.1.0", + "doctrine/annotations": "^1.13", + "spiral/attributes": "^2.8|^3.0", + "spiral/tokenizer": "^2.8|^3.0", + "doctrine/inflector": "^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.18" + }, + "autoload": { + "psr-4": { + "Cycle\\Annotated\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Cycle\\Annotated\\Tests\\": "tests/Annotated/" + } } - }, - "autoload-dev": { - "psr-4": { - "Cycle\\Annotated\\Tests\\": "tests/Annotated/" - } - } } From 67e468381acabf6164d457fe861a90719801a246 Mon Sep 17 00:00:00 2001 From: Maxim Smakouz Date: Mon, 16 Jan 2023 10:51:45 +0200 Subject: [PATCH 4/4] Up cycle/schema-builder version --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 758ebc56..806dd18f 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,7 @@ "require": { "php": ">=8.0", "cycle/orm": "^2.2.0", - "cycle/database": "^2.3", - "cycle/schema-builder": "^2.1.0", + "cycle/schema-builder": "^2.2", "doctrine/annotations": "^1.13", "spiral/attributes": "^2.8|^3.0", "spiral/tokenizer": "^2.8|^3.0",