Exemple #1
0
 /**
  * Gets the constructor from a class.
  *
  * @return ReflectionMethod A `ReflectionMethod` object or null if the class has no constructor.
  */
 public function getConstructor()
 {
     /* @var \ReflectionClass $method */
     $method = parent::getConstructor();
     if (!$method) {
         return null;
     }
     return new ReflectionMethod($this->getName(), $method->getName());
 }
 /**
  * Test if the `getConstructor` method return null if a class has no constructor.
  */
 public function testGetConstructorReturnNull()
 {
     $className = self::FIXTURE_NS . '\\ClassWithoutConstructor';
     $object = new ReflectionObject(new $className());
     $this->assertNull($object->getConstructor());
 }