In my Restler API class I have an object defined like so (with lots of other params)
class PatchTaskObj extends TaskObj {
/**
* @var bool|null Whether or not this Task should be pinned to the top of the list {@required false}
*/
public $pinned = null;
}
And then I attempt to use it in my PATCH method:
/**
* Updates an existing Task record.
*
* @param int $id The SQL ident of the task you wish to update. {@min 1} {@from path}
* @param PatchTaskObj $info The properties of the Task to update.
*
* @throws RestException 412 Thrown if at least one update isn't passed in.
*
* @status 204
*/
function patch($id, PatchTaskObj $info)
If I pass in true
for the pinned
property it works fine, but if I pass false
then I get a 400 from Restler with the message:
Bad Request: Invalid value specified for
info[pinned]
OK, discovered that Restler's Validator.php is failing to parse the @var property the way it's written. If you remove the |null
part then it works as expected. I've submitted an issue to the github site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With