Make sure baked controllers follow CakePHP codding standard
Throwing Method Not Allowed exception in delete method was initially introduced in e380b76 but seem to be removed over time.
I noticed that PHP code sniffer throws errors like Expected 1 @throws tag(s) in function comment; 2 found for newly baked controllers.
Expected 1 @throws tag(s) in function comment; 2 found
This commit solves the inconsistency with @throws declarations in delete method's docblock and ultimately it makes sense not to expose delete methods to be accessible via GET requests.
You can not throw that without defining which methods are allowed.
http specs require to list the allowed methods, we had discussed adding this to bake, but had decided not to.
Exceptions now have the a method to define headers to include the allowed methods:
Also, if you want to include them in your baked controllers, you just have to create your own custom bake templates with that snippet included - what I do for all my (admin) delete actions.
Remove unnecessary @throws tag in baked controller
Oh I understand. Perhaps just removing unnecesary @throws tag makes more sense in order to make baked controllers clean from CakePHP codding standard perspective.
That is the exact thing I was doing. Thanks for sharing the trick :)
@borivojevic I removed the extraneous @throws in 9d367e1