Skip to content

Conversation

@jeffersongoncalves
Copy link
Contributor

In this project, we use integer values ​​in the gate.

image

@barryvdh barryvdh merged commit ea43bac into fruitcake:master Jan 29, 2026
21 checks passed
@erikn69
Copy link
Contributor

erikn69 commented Jan 29, 2026

$ability should not be int according to the docs,
you should cast those ints to strings

DOCS: https://laravel.com/docs/12.x/authorization#intercepting-gate-checks
PHPDOC Source: Illuminate/Auth/Access/Gate.php#L428

@jeffersongoncalves
Copy link
Contributor Author

The problem is that the method signature doesn't specify a string, only the PHPDoc for the method.

Since the value in GateCollector.php is typed as a string, this caused the problem, which led to a PR request to add the int type. This is because the Laravel Gate core itself doesn't have the string value fixed in its $ability.

Gate->define allows string or UnitEnums: Illuminate/Auth/Access/Gate.php#L203

@jeffersongoncalves jeffersongoncalves deleted the patch-1 branch January 29, 2026 14:13
@barryvdh
Copy link
Member

I don't think we need to be stricter then Laravel, we want to avoid triggering errors on anything that we can do in Laravel, even it's not totally correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants