Skip to content

Commit

Permalink
minor #237 Updated the FlagBag templates. (laurentmuller)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x-dev branch.

Discussion
----------

Updated the FlagBag templates.

This is the correction for issue #192.
It's seem that I never created a pull request for this.

Commits
-------

5673f43 Updated the FlagBag templates
  • Loading branch information
ogizanagi committed Jan 20, 2025
2 parents d44e139 + 5673f43 commit 0e67f9b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/FlagBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,27 @@ private static function checkIntBackedEnumType(string|object $enumOrType): void
}

/**
* @param class-string<T> $enumType
* @template E of \BackedEnum
*
* @param class-string<E> $enumType
*
* @return FlagBag<T>
* @return FlagBag<E>
*/
public static function fromAll(string $enumType): FlagBag
{
return new FlagBag($enumType, static::getBitmask($enumType));
}

/**
* @psalm-template E of \BackedEnum
*
* @param class-string<T>|T $enumOrType
*
* @psalm-param E ...$flags
*
* @phpstan-return FlagBag<T>
*
* @psalm-return FlagBag<E>
*/
public static function from(string|\BackedEnum $enumOrType, \BackedEnum ...$flags): static
{
Expand Down

0 comments on commit 0e67f9b

Please sign in to comment.