Doctrine Common
  1. Doctrine Common
  2. DCOM-97

phpParser.php and 'use' keyword in anonymous functions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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

        Activity

        Thomas Lecarpentier created issue -
        Thomas Lecarpentier made changes -
        Field Original Value New Value
        Affects Version/s 2.1.4 [ 10180 ]
        Affects Version/s 2.0.0-BETA2 [ 10061 ]
        Hide
        Fabio B. Silva added a comment -

        I think this is fixed on the php parser rewrite. (2.2)

        Show
        Fabio B. Silva added a comment - I think this is fixed on the php parser rewrite. (2.2)
        Hide
        Fabio B. Silva added a comment -
        Show
        Fabio B. Silva added a comment - Coverage added : https://github.com/doctrine/common/commit/7ec510dbb2279f76a00ecf3f911298879c6ba1a1 I think this could be closed..
        Hide
        Fabio B. Silva added a comment -

        Fixed on php parser rewrite. (2.2)

        Show
        Fabio B. Silva added a comment - Fixed on php parser rewrite. (2.2)
        Fabio B. Silva made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 2.2 [ 10152 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13442 ] jira-feedback2 [ 17949 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17949 ] jira-feedback3 [ 19912 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DCOM-97, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Thomas Lecarpentier
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: