[12.x] Feature: allow UnitEnum in has() method of Gate class#58310
Merged
taylorotwell merged 7 commits intolaravel:12.xfrom Jan 7, 2026
Merged
[12.x] Feature: allow UnitEnum in has() method of Gate class#58310taylorotwell merged 7 commits intolaravel:12.xfrom
taylorotwell merged 7 commits intolaravel:12.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for UnitEnum as a parameter type to the Gate::has() method, aligning it with the Gate::define() method which already accepts UnitEnum. This change ensures consistency across the Gate API when working with enum-based abilities.
Key Changes:
- Updated the
Gate::has()method to acceptUnitEnumin addition tostringandarray - Added
enum_value()function call in the implementation to properly handle enum values - Updated PHPDoc annotations across the facade, contract interface, and implementation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Illuminate/Support/Facades/Gate.php |
Updated PHPDoc to include \UnitEnum type for the has() method |
src/Illuminate/Contracts/Auth/Access/Gate.php |
Updated interface PHPDoc to include \UnitEnum type for the has() method parameter |
src/Illuminate/Auth/Access/Gate.php |
Updated implementation PHPDoc and added enum_value() call to properly handle enum values in the abilities check |
Comments suppressed due to low confidence (1)
src/Illuminate/Auth/Access/Gate.php:21
- This extra blank line should be removed to maintain code formatting consistency.
class Gate implements GateContract
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the
Gate::define()method allows the$abilityargument to be an Enum, theGate::has()method should also accept an Enum.This PR aligns both methods for consistency.