Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8
    • Component/s: Parser
    • Labels:
      None

      Description

      http://php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes

      <?php
      interface Logger {
          public function log(string $msg);
      }
      
      class Application {
          private $logger;
      
          public function getLogger(): Logger {
               return $this->logger;
          }
      
          public function setLogger(Logger $logger) {
               $this->logger = $logger;
          }
      }
      
      $app = new Application;
      $app->setLogger(new class implements Logger {    // here!
          public function log(string $msg) {
              echo $msg;
          }
      });
      
      var_dump($app->getLogger());
      ?>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              elena.vilchik Elena Vilchik
              Reporter:
              elena.vilchik Elena Vilchik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: