diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd8518ec..d41aa9dd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: - name: Setup DB services run: | cd tests - docker-compose up -d + docker compose up -d cd .. - name: Setup PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 diff --git a/src/Annotation/Inheritance/SingleTable.php b/src/Annotation/Inheritance/SingleTable.php index b67d02aa..2fd5f124 100644 --- a/src/Annotation/Inheritance/SingleTable.php +++ b/src/Annotation/Inheritance/SingleTable.php @@ -15,9 +15,14 @@ #[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor] class SingleTable extends Inheritance { + protected ?string $value; + public function __construct( - protected ?string $value = null + string|int|float|\Stringable|\BackedEnum|null $value = null ) { + $this->value = $value === null + ? null + : (string) ($value instanceof \BackedEnum ? $value->value : $value); parent::__construct('single'); } diff --git a/tests/Annotated/Unit/Attribute/SingleTable/IntegerEnum.php b/tests/Annotated/Unit/Attribute/SingleTable/IntegerEnum.php new file mode 100644 index 00000000..251a807b --- /dev/null +++ b/tests/Annotated/Unit/Attribute/SingleTable/IntegerEnum.php @@ -0,0 +1,11 @@ +assertSame($expected, $attribute->getValue()); + } +} diff --git a/tests/Annotated/Unit/Attribute/SingleTable/StringEnum.php b/tests/Annotated/Unit/Attribute/SingleTable/StringEnum.php new file mode 100644 index 00000000..c9325a1e --- /dev/null +++ b/tests/Annotated/Unit/Attribute/SingleTable/StringEnum.php @@ -0,0 +1,11 @@ +value; + } +} diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 5ee2054f..2c2cf73c 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -11,7 +11,7 @@ services: ACCEPT_EULA: "Y" mysql_latest: - image: mysql:latest + image: mysql:8.0 restart: always command: --default-authentication-plugin=mysql_native_password ports: