Skip to content

Commit

Permalink
Sort PublicationFieldTypes enum cases
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 23, 2022
1 parent f1ed5af commit 8205f09
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
*/
enum PublicationFieldTypes: string
{
case String = 'string';
case Array = 'array';
case Boolean = 'boolean';
case Integer = 'integer';
case Float = 'float';
case Datetime = 'datetime';
case Url = 'url';
case Array = 'array';
case Text = 'text';
case Float = 'float';
case Image = 'image';
case Integer = 'integer';
case String = 'string';
case Tag = 'tag';
case Text = 'text';
case Url = 'url';

public function rules(): array
{
Expand All @@ -44,16 +44,16 @@ public static function getRules(self $type): array
{
/** @noinspection PhpDuplicateMatchArmBodyInspection */
return match ($type) {
self::String => ['string'],
self::Array => ['array'],
self::Boolean => ['boolean'],
self::Integer => ['integer', 'numeric'],
self::Float => ['numeric'],
self::Datetime => ['date'],
self::Url => ['url'],
self::Text => ['string'],
self::Array => ['array'],
self::Float => ['numeric'],
self::Image => [],
self::Integer => ['integer', 'numeric'],
self::String => ['string'],
self::Tag => [],
self::Text => ['string'],
self::Url => ['url'],
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ public function testCollectCreatesCollectionOfCases()
public function testValuesReturnsArrayOfCaseValues()
{
$this->assertSame([
0 => 'string',
0 => 'array',
1 => 'boolean',
2 => 'integer',
2 => 'datetime',
3 => 'float',
4 => 'datetime',
5 => 'url',
6 => 'array',
7 => 'text',
8 => 'image',
9 => 'tag',
4 => 'image',
5 => 'integer',
6 => 'string',
7 => 'tag',
8 => 'text',
9 => 'url',
], PublicationFieldTypes::values());
}
}

0 comments on commit 8205f09

Please sign in to comment.