Skip to content

Commit

Permalink
Add typehints for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjonard committed Jan 8, 2024
1 parent 484c8c4 commit 2d5834b
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 82 deletions.
18 changes: 9 additions & 9 deletions src/Enum/ConfigurationEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

class ConfigurationEnum
{
public const THUMBNAILS_FORMAT = 'thumbnails-format';
public const string THUMBNAILS_FORMAT = 'thumbnails-format';

public const CUSTOM_LIGHT_THEME_CSS = 'custom-light-theme-css';
public const string CUSTOM_LIGHT_THEME_CSS = 'custom-light-theme-css';

public const CUSTOM_DARK_THEME_CSS = 'custom-dark-theme-css';
public const string CUSTOM_DARK_THEME_CSS = 'custom-dark-theme-css';

public const THUMBNAILS_FORMAT_KEEP_ORIGINAL = null;
public const null THUMBNAILS_FORMAT_KEEP_ORIGINAL = null;

public const THUMBNAILS_FORMAT_JPEG = 'jpeg';
public const string THUMBNAILS_FORMAT_JPEG = 'jpeg';

public const THUMBNAILS_FORMAT_PNG = 'png';
public const string THUMBNAILS_FORMAT_PNG = 'png';

public const THUMBNAILS_FORMAT_WEBP = 'webp';
public const string THUMBNAILS_FORMAT_WEBP = 'webp';

public const THUMBNAILS_FORMAT_AVIF = 'avif';
public const string THUMBNAILS_FORMAT_AVIF = 'avif';

public const THUMBNAIL_FORMATS = [
public const array THUMBNAIL_FORMATS = [
self::THUMBNAILS_FORMAT_KEEP_ORIGINAL,
self::THUMBNAILS_FORMAT_JPEG,
self::THUMBNAILS_FORMAT_PNG,
Expand Down
18 changes: 9 additions & 9 deletions src/Enum/DateFormatEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@

class DateFormatEnum
{
public const FORMAT_SLASH_DMY = 'd/m/Y';
public const string FORMAT_SLASH_DMY = 'd/m/Y';

public const FORMAT_SLASH_MDY = 'm/d/Y';
public const string FORMAT_SLASH_MDY = 'm/d/Y';

public const FORMAT_SLASH_YMD = 'Y/m/d';
public const string FORMAT_SLASH_YMD = 'Y/m/d';

public const FORMAT_HYPHEN_DMY = 'd-m-Y';
public const string FORMAT_HYPHEN_DMY = 'd-m-Y';

public const FORMAT_HYPHEN_MDY = 'm-d-Y';
public const string FORMAT_HYPHEN_MDY = 'm-d-Y';

public const FORMAT_HYPHEN_YMD = 'Y-m-d';
public const string FORMAT_HYPHEN_YMD = 'Y-m-d';

public const CONTEXT_FORM = 'form';
public const string CONTEXT_FORM = 'form';

public const CONTEXT_TWIG = 'twig';
public const string CONTEXT_TWIG = 'twig';

public const CONTEXT_JS = 'js';
public const string CONTEXT_JS = 'js';

public const FORMATS = [
self::FORMAT_SLASH_DMY,
Expand Down
40 changes: 20 additions & 20 deletions src/Enum/DatumTypeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@

class DatumTypeEnum
{
public const TYPE_TEXT = 'text';
public const string TYPE_TEXT = 'text';

public const TYPE_TEXTAREA = 'textarea';
public const string TYPE_TEXTAREA = 'textarea';

public const TYPE_COUNTRY = 'country';
public const string TYPE_COUNTRY = 'country';

public const TYPE_DATE = 'date';
public const string TYPE_DATE = 'date';

public const TYPE_RATING = 'rating';
public const string TYPE_RATING = 'rating';

public const TYPE_NUMBER = 'number';
public const string TYPE_NUMBER = 'number';

public const TYPE_PRICE = 'price';
public const string TYPE_PRICE = 'price';

public const TYPE_LINK = 'link';
public const string TYPE_LINK = 'link';

public const TYPE_LIST = 'list';
public const string TYPE_LIST = 'list';

public const TYPE_CHOICE_LIST = 'choice-list';
public const string TYPE_CHOICE_LIST = 'choice-list';

public const TYPE_CHECKBOX = 'checkbox';
public const string TYPE_CHECKBOX = 'checkbox';

public const TYPE_IMAGE = 'image';
public const string TYPE_IMAGE = 'image';

public const TYPE_FILE = 'file';
public const string TYPE_FILE = 'file';

public const TYPE_SIGN = 'sign';
public const string TYPE_SIGN = 'sign';

public const TYPES = [
public const array TYPES = [
self::TYPE_TEXT,
self::TYPE_TEXTAREA,
self::TYPE_COUNTRY,
Expand All @@ -50,7 +50,7 @@ class DatumTypeEnum
self::TYPE_SIGN,
];

public const TEXT_TYPES = [
public const array TEXT_TYPES = [
self::TYPE_TEXT,
self::TYPE_TEXTAREA,
self::TYPE_COUNTRY,
Expand All @@ -65,26 +65,26 @@ class DatumTypeEnum
self::TYPE_CHECKBOX,
];

public const IMAGE_TYPES = [
public const array IMAGE_TYPES = [
self::TYPE_IMAGE,
self::TYPE_SIGN,
];

public const AVAILABLE_FOR_SCRAPING = [
public const array AVAILABLE_FOR_SCRAPING = [
self::TYPE_TEXT,
self::TYPE_TEXTAREA,
self::TYPE_LIST,
self::TYPE_COUNTRY,
];

public const AVAILABLE_FOR_SEARCH = [
public const array AVAILABLE_FOR_SEARCH = [
self::TYPE_TEXT,
self::TYPE_LIST,
self::TYPE_CHOICE_LIST,
self::TYPE_TEXTAREA,
];

public const TYPES_TRANS_KEYS = [
public const array TYPES_TRANS_KEYS = [
self::TYPE_TEXT => 'label.text',
self::TYPE_TEXTAREA => 'label.textarea',
self::TYPE_SIGN => 'label.sign',
Expand Down
6 changes: 3 additions & 3 deletions src/Enum/DisplayModeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

class DisplayModeEnum
{
public const DISPLAY_MODE_GRID = 'grid';
public const string DISPLAY_MODE_GRID = 'grid';

public const DISPLAY_MODE_LIST = 'list';
public const string DISPLAY_MODE_LIST = 'list';

public const DISPLAY_MODES = [
public const array DISPLAY_MODES = [
self::DISPLAY_MODE_GRID,
self::DISPLAY_MODE_LIST,
];
Expand Down
34 changes: 17 additions & 17 deletions src/Enum/HistoryFilterEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@

class HistoryFilterEnum
{
public const FILTER_CLASS_COLLECTION = 'collection';
public const string FILTER_CLASS_COLLECTION = 'collection';

public const FILTER_CLASS_ITEM = 'item';
public const string FILTER_CLASS_ITEM = 'item';

public const FILTER_CLASS_TEMPLATE = 'template';
public const string FILTER_CLASS_TEMPLATE = 'template';

public const FILTER_CLASS_CHOICE_LIST = 'choiceList';
public const string FILTER_CLASS_CHOICE_LIST = 'choiceList';

public const FILTER_CLASS_INVENTORY = 'inventory';
public const string FILTER_CLASS_INVENTORY = 'inventory';

public const FILTER_CLASS_TAG = 'tag';
public const string FILTER_CLASS_TAG = 'tag';

public const FILTER_CLASS_TAG_CATEGORY = 'tagCategory';
public const string FILTER_CLASS_TAG_CATEGORY = 'tagCategory';

public const FILTER_CLASS_ALBUM = 'album';
public const string FILTER_CLASS_ALBUM = 'album';

public const FILTER_CLASS_PHOTO = 'photo';
public const string FILTER_CLASS_PHOTO = 'photo';

public const FILTER_CLASS_WISHLIST = 'wishlist';
public const string FILTER_CLASS_WISHLIST = 'wishlist';

public const FILTER_CLASS_WISH = 'wish';
public const string FILTER_CLASS_WISH = 'wish';

public const FILTER_TYPE_CREATE = LogTypeEnum::TYPE_CREATE;
public const string FILTER_TYPE_CREATE = LogTypeEnum::TYPE_CREATE;

public const FILTER_TYPE_DELETE = LogTypeEnum::TYPE_DELETE;
public const string FILTER_TYPE_DELETE = LogTypeEnum::TYPE_DELETE;

public const FILTERS_CLASS = [
public const array FILTERS_CLASS = [
self::FILTER_CLASS_COLLECTION,
self::FILTER_CLASS_ITEM,
self::FILTER_CLASS_TEMPLATE,
Expand All @@ -46,12 +46,12 @@ class HistoryFilterEnum
self::FILTER_CLASS_WISH,
];

public const FILTERS_TYPE = [
public const array FILTERS_TYPE = [
self::FILTER_TYPE_CREATE,
self::FILTER_TYPE_DELETE,
];

public const CLASS_TRANS_KEYS = [
public const array CLASS_TRANS_KEYS = [
self::FILTER_CLASS_COLLECTION => 'enum.history_filter_class.collection',
self::FILTER_CLASS_ITEM => 'enum.history_filter_class.item',
self::FILTER_CLASS_TAG => 'enum.history_filter_class.tag',
Expand All @@ -66,7 +66,7 @@ class HistoryFilterEnum
self::FILTER_CLASS_WISH => 'enum.history_filter_class.wish',
];

public const TYPES_TRANS_KEYS = [
public const array TYPES_TRANS_KEYS = [
self::FILTER_TYPE_CREATE => 'enum.history_filter_type.create',
self::FILTER_TYPE_DELETE => 'enum.history_filter_type.delete',
];
Expand Down
4 changes: 2 additions & 2 deletions src/Enum/LogTypeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LogTypeEnum
{
public const TYPE_CREATE = 'create';
public const string TYPE_CREATE = 'create';

public const TYPE_DELETE = 'delete';
public const string TYPE_DELETE = 'delete';
}
4 changes: 2 additions & 2 deletions src/Enum/ReservedLabelEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ReservedLabelEnum
{
public const NUMBER_OF_ITEMS = 'koi-number-of-items';
public const string NUMBER_OF_ITEMS = 'koi-number-of-items';

public const NUMBER_OF_CHILDREN = 'koi-number-of-children';
public const string NUMBER_OF_CHILDREN = 'koi-number-of-children';
}
8 changes: 4 additions & 4 deletions src/Enum/RoleEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

class RoleEnum
{
public const ROLE_USER = 'ROLE_USER';
public const string ROLE_USER = 'ROLE_USER';

public const ROLE_ADMIN = 'ROLE_ADMIN';
public const string ROLE_ADMIN = 'ROLE_ADMIN';

public const ROLES = [
public const array ROLES = [
self::ROLE_USER,
self::ROLE_ADMIN,
];

public const ROLES_TRANS_KEYS = [
public const array ROLES_TRANS_KEYS = [
self::ROLE_USER => 'role.user',
self::ROLE_ADMIN => 'role.admin',
];
Expand Down
6 changes: 3 additions & 3 deletions src/Enum/ScraperTypeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class ScraperTypeEnum
{
public const TYPE_ITEM = 'item';
public const string TYPE_ITEM = 'item';

public const TYPE_COLLECTION = 'collection';
public const string TYPE_COLLECTION = 'collection';

public const TYPE_WISH = 'wish';
public const string TYPE_WISH = 'wish';
}
6 changes: 3 additions & 3 deletions src/Enum/SortingDirectionEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class SortingDirectionEnum
{
public const ASCENDING = Criteria::ASC;
public const string ASCENDING = Criteria::ASC;

public const DESCENDING = Criteria::DESC;
public const string DESCENDING = Criteria::DESC;

public const SORTING_DIRECTIONS = [
public const array SORTING_DIRECTIONS = [
self::ASCENDING,
self::DESCENDING,
];
Expand Down
10 changes: 5 additions & 5 deletions src/Enum/ThemeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

class ThemeEnum
{
public const THEME_BROWSER = 'browser';
public const string THEME_BROWSER = 'browser';

public const THEME_LIGHT = 'light';
public const string THEME_LIGHT = 'light';

public const THEME_DARK = 'dark';
public const string THEME_DARK = 'dark';

public const THEMES = [
public const array THEMES = [
self::THEME_BROWSER,
self::THEME_LIGHT,
self::THEME_DARK,
];

public const THEMES_TRANS_KEYS = [
public const array THEMES_TRANS_KEYS = [
self::THEME_BROWSER => 'browser',
self::THEME_LIGHT => 'light',
self::THEME_DARK => 'dark',
Expand Down
10 changes: 5 additions & 5 deletions src/Enum/VisibilityEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

class VisibilityEnum
{
public const VISIBILITY_PUBLIC = 'public';
public const string VISIBILITY_PUBLIC = 'public';

public const VISIBILITY_INTERNAL = 'internal';
public const string VISIBILITY_INTERNAL = 'internal';

public const VISIBILITY_PRIVATE = 'private';
public const string VISIBILITY_PRIVATE = 'private';

public const VISIBILITIES = [
public const array VISIBILITIES = [
self::VISIBILITY_PUBLIC,
self::VISIBILITY_INTERNAL,
self::VISIBILITY_PRIVATE,
];

public const VISIBILITIES_TRANS_KEYS = [
public const array VISIBILITIES_TRANS_KEYS = [
self::VISIBILITY_PUBLIC => 'public',
self::VISIBILITY_INTERNAL => 'internal',
self::VISIBILITY_PRIVATE => 'private',
Expand Down

0 comments on commit 2d5834b

Please sign in to comment.