Skip to content

Commit

Permalink
Document StringBasedEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
martinstuecklschwaiger committed Dec 16, 2024
1 parent 2ae3e45 commit e3a02e2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Core/Core_c.php
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,25 @@ interface StringBackedEnum extends BackedEnum
{
public readonly string $value;

/**
* Translates a string into the corresponding <code>Enum</code>
* case, if any. If there is no matching case defined, it will throw a
* <code>ValueError</code>.
* @param string $value
* @return static
* @throws ValueError if there is no matching case defined
* @link https://www.php.net/manual/en/backedenum.from.php
*/
#[Pure]
public static function from(string $value): static;

/**
* Translates a string or int into the corresponding <code>Enum</code>
* case, if any. If there is no matching case defined, it will return null.
* @param string $value
* @return static|null
* @link https://www.php.net/manual/en/backedenum.tryfrom.php
*/
#[Pure]
public static function tryFrom(string $value): ?static;
}
Expand Down

0 comments on commit e3a02e2

Please sign in to comment.