use keyword isn't supported

PHP 5.3 introduced the 'use' keyword for lambda functions. WebIDE 387 doesn't recognize it

Example code

class Cart {
     const PRICE_BUTTER  = 1.00;
     const PRICE_MILK    = 3.00;
     const PRICE_EGGS    = 6.95;
     protected   $products = array();
         public function add($product, $quantity)
     {
         $this->products[$product] = $quantity;
     }
         public function getQuantity($product)
     {
         return isset($this->products[$product]) ? $this->products[$product] :                FALSE;
     }
         public function getTotal($tax)
     {
         $total = 0.00;
                 $callback =
            function ($quantity, $product) use ($tax, &$total)
             {
                 $pricePerItem = constant(__CLASS__ . "::PRICE_" .
                     strtoupper($product));
                 $total += ($pricePerItem * $quantity) * ($tax + 1.0);
             };
                 array_walk($this->products, $callback);
         return round($total, 2);;
     }

}



0

BTW, thanks for feedback on 5.3 features. Support for these features was added right before EAP and seems like we overlooked some parts of spec. All of these will receive high priority.

0
Avatar
Permanently deleted user

multiple use statements are also not working
example code

use My\Full\Classname as Another, My\Full\NSname;
0

Thanks, that one is now addressed too.

0

请先登录再写评论。