Skip to content

refactor(sanctum): use Str::from() helpers for BackedEnum handling#306

Merged
albertcht merged 1 commit intohypervel:mainfrom
binaryfire:refactor-enum-handling-to-str-helpers
Dec 24, 2025
Merged

refactor(sanctum): use Str::from() helpers for BackedEnum handling#306
albertcht merged 1 commit intohypervel:mainfrom
binaryfire:refactor-enum-handling-to-str-helpers

Conversation

@binaryfire
Copy link
Contributor

Refactors Sanctum's manual instanceof BackedEnum checks to use the Str::from() and Str::fromAll() helpers from #291, for consistency across the codebase.

Changes:

  • PersonalAccessToken::can() → Str::from()
  • HasApiTokens::createToken() → Str::fromAll()

No functional changes. Added 7 tests for BackedEnum ability checking.

Replace manual `instanceof BackedEnum` checks with the Str::from()
and Str::fromAll() helpers introduced in hypervel#291.

Changes:
- PersonalAccessToken::can() now uses Str::from()
- HasApiTokens::createToken() now uses Str::fromAll()

Added 7 new tests for BackedEnum ability checking.
@albertcht albertcht added the enhancement Improved feature or adjustments. label Dec 24, 2025
@albertcht albertcht merged commit 782eb68 into hypervel:main Dec 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improved feature or adjustments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants