Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1.4
-
Fix Version/s: 2.2
-
Component/s: Annotations
-
Labels:None
-
Environment:php 5.3, Symfony2, linux
Description
When i use the keyword 'use' in anonymous function (like describe in page http://php.net/manual/en/functions.anonymous.php)
Exemple :
...
/**
*
- Extract event from all events for this day
- @param int $year
- @param int $month
- @param int $day
- @return ArrayCollection
*/
public function getEventsForDate($year, $month, $day)Unknown macro: { $extractEvents = null; // check if date of item is inside day given $extractEvents = $this->events->filter( function ($item) use ($year, $month, $day) { $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); } ); return $extractEvents; }
...
The phpParser generate error
[ErrorException]
Notice: Undefined offset: -1 in /home/ent/project/Symfony/vendor/doctrine-common/lib/Doctrine/Common/Annotations/PhpParser.php line 117
It try to parse 'use ($year, $month, $day)' as Class