Closed Aluisio-Pires closed 3 days ago
This would be a security issue. If this were to be changed, it should be deny by default.
See above.
This would be a security issue. If this were to be changed, it should be deny by default.
Really good point. I was avoiding the same FormRequests behavior were we are forced to change the authorize return, but I see the issue. I will reopen de PR changing to false.
See above.
@taylorotwell I've created a new PR following the recommendations.
Summary
This PR resolves an issue where the methods in policies generated via commands such as
make:model ModelName --policy
returned abool
type but lacked implementations, causing PhpStan to report type errors. The problem stems from the empty method bodies in the default policy stubs.Changes Made
true
return values for all methods:viewAny
view
create
update
delete
restore
forceDelete
This ensures the generated methods comply with their defined return types and eliminates PhpStan type-checking errors.
How to Test
php artisan make:model Example --policy
.true
return values.Impact
This change improves developer experience by making generated policies immediately usable without requiring manual fixes to satisfy static analysis.
Let me know if further details are needed!