Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/*
* This file is part of the Kimai time-tracking app.
*
@@ -11,47 +9,16 @@ declare(strict_types=1);
namespace App\Export\Annotation;
use Doctrine\Common\Annotations\Annotation\Enum;
use Doctrine\Common\Annotations\Annotation\Required;
/**
* Annotation class for @Expose().
*
* @Annotation
* @Target({"CLASS", "PROPERTY", "METHOD"})
*/
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD)]
final class Expose
{
/**
* @var string
* @Required
*/
public $label;
/**
* @var string
*/
public $name;
/**
* @Enum({"string", "datetime", "date", "time", "integer", "float", "duration", "boolean", "array"})
*/
public $type = 'string';
/**
* @var string
*/
public $exp = null;
public string $type = 'string';
public function __construct(array $data)
public function __construct(public ?string $name = null, public ?string $label = null, string $type = 'string', public ?string $exp = null)
{
if (isset($data['value'])) {
$this->name = $data['value'];
unset($data['value']);
}
foreach ($data as $key => $value) {
if (!property_exists(self::class, $key)) {
throw new \InvalidArgumentException(sprintf('Unknown property "%s" on annotation "%s".', $key, self::class));
}
$this->{$key} = $value;
if (!\in_array($type, ['string', 'datetime', 'date', 'time', 'integer', 'float', 'duration', 'boolean', 'array'])) {
throw new \InvalidArgumentException(sprintf('Unknown type "%s" on annotation "%s".', $type, self::class));
}
$this->type = $type;
}
}

View File

@@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/*
* This file is part of the Kimai time-tracking app.
*
@@ -11,22 +9,10 @@ declare(strict_types=1);
namespace App\Export\Annotation;
/**
* @Annotation
* @Target({"CLASS"})
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
final class Order
{
/**
* @var array<string>
*/
public $order = [];
public function __construct(array $data)
public function __construct(public array $order = [])
{
if (isset($data['value'])) {
$this->order = $data['value'];
unset($data['value']);
}
}
}