コード例 #1
0
ファイル: AccessorProperty.php プロジェクト: watoki/reflect
 /**
  * @return Type
  */
 public function type()
 {
     if ($this->getter) {
         $analyzer = new MethodAnalyzer($this->getter);
         return $analyzer->getReturnType($this->types);
     } else {
         if ($this->setter) {
             $analyzer = new MethodAnalyzer($this->setter);
             $types = array_values($analyzer->getTypes($this->types));
             return $types[0];
         }
     }
     return new UnknownType();
 }
コード例 #2
0
ファイル: MethodAnalyzerTest.php プロジェクト: watoki/reflect
 function testNullableTypes()
 {
     $method = new MethodAnalyzer(new \ReflectionMethod(MethodAnalyzerTest_Foo::$CLASS, 'third'));
     $this->assertEquals($method->getTypes(new TypeFactory()), array('one' => new NullableType(new UnknownType()), 'two' => new NullableType(new StringType()), 'three' => new NullableType(new ClassType('DateTime'))));
 }