Skip to content

Commit

Permalink
fix: PHP Fatal error:
Browse files Browse the repository at this point in the history
  Enum case value must be compile-time evaluatable
   in /home/runner/work/rephine/rephine/src/Sorting/Type.php on line 26
  • Loading branch information
Yogarine committed Feb 1, 2025
1 parent 80f02e4 commit 6102fc0
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/Sorting/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,52 @@ enum Type: int
{
use EnumDynamicity;

private const REGULAR = \SORT_REGULAR;

private const REGULAR_CASE_INSENSITIVE = \SORT_REGULAR | \SORT_FLAG_CASE;

private const NUMERIC = \SORT_NUMERIC;

private const STRING = \SORT_STRING;

private const STRING_CASE_INSENSITIVE = \SORT_STRING | \SORT_FLAG_CASE;

private const LOCALE_STRING = \SORT_LOCALE_STRING;

private const NATURAL = \SORT_NATURAL;

/**
* Compare items normally.
*/
case Regular = SORT_REGULAR;
case Regular = self::REGULAR;

/**
* Sort strings normally, case-insensitively.
*/
case RegularCaseInsensitive = SORT_REGULAR | SORT_FLAG_CASE;
case RegularCaseInsensitive = self::REGULAR_CASE_INSENSITIVE;

/**
* Compare items numerically.
*/
case Numeric = SORT_NUMERIC;
case Numeric = self::NUMERIC;

/**
* Compare items as strings.
*/
case String = SORT_STRING;
case String = self::STRING;

/**
* Compare items as strings, case-insensitively.
*/
case StringCaseInsensitive = SORT_STRING | SORT_FLAG_CASE;
case StringCaseInsensitive = self::STRING_CASE_INSENSITIVE;

/**
* Compare items as strings, based on the current locale.
*/
case LocaleString = SORT_LOCALE_STRING;
case LocaleString = self::LOCALE_STRING;

/**
* Compare items as strings using "natural ordering" like `natsort()`.
*/
case Natural = SORT_NATURAL;
case Natural = self::NATURAL;
}

0 comments on commit 6102fc0

Please sign in to comment.