skip to Main Content
public function aroundPlaceOrder(MagentoQuoteModelQuoteManagement $subject, callable $proceed, $cartId, $paymentMethod = null)

Can anyone tell me what “callable” does?

I can’t find it anywhere else in the code and it’s not setup like a variable like the rest inside this method.

2

Answers


  1. It’s the type of the $proceed variable, which means your function accepts a callback function.

    Callbacks can be denoted by callable type hint as of PHP 5.4

    http://php.net/manual/en/language.types.callable.php

    Hope it helps!!

    Login or Signup to reply.
  2. Basically, a callable (or callback) it’s like a function that takes another function in argument. So per example.

    function myFunction(Callable $myOtherFunction) {
    
    }
    

    You would this function like so:

    myFunction(function() {
    
    })
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search