File tree 1 file changed +4
-14
lines changed
1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -365,29 +365,19 @@ public function setPrefix($prefix)
365
365
/**
366
366
* Register callback for an attribute
367
367
*
368
- * @param string $name Name of the attribute to register the callback for
369
- * @param callable $callback Callback to call when retrieving the attribute
370
- * @param callable $setterCallback Callback to call when setting the attribute
368
+ * @param string $name Name of the attribute to register the callback for
369
+ * @param ? callable $callback Callback to call when retrieving the attribute
370
+ * @param ? callable $setterCallback Callback to call when setting the attribute
371
371
*
372
372
* @return $this
373
- *
374
- * @throws InvalidArgumentException If $callback is not callable or if $setterCallback is set and not callable
375
373
*/
376
- public function registerAttributeCallback ($ name , $ callback , $ setterCallback = null )
374
+ public function registerAttributeCallback (string $ name , ? callable $ callback , ? callable $ setterCallback = null ): self
377
375
{
378
376
if ($ callback !== null ) {
379
- if (! is_callable ($ callback )) {
380
- throw new InvalidArgumentException (__METHOD__ . ' expects a callable callback ' );
381
- }
382
-
383
377
$ this ->callbacks [$ name ] = $ callback ;
384
378
}
385
379
386
380
if ($ setterCallback !== null ) {
387
- if (! is_callable ($ setterCallback )) {
388
- throw new InvalidArgumentException (__METHOD__ . ' expects a callable setterCallback ' );
389
- }
390
-
391
381
$ this ->setterCallbacks [$ name ] = $ setterCallback ;
392
382
}
393
383
You can’t perform that action at this time.
0 commit comments