1 | <?php |
||
38 | class PhpFunction extends AbstractModel implements GenerateableInterface, NamespaceInterface, DocblockInterface, RoutineInterface { |
||
39 | |||
40 | use BodyPart; |
||
41 | use DocblockPart; |
||
42 | use LongDescriptionPart; |
||
43 | use ParametersPart; |
||
44 | use QualifiedNamePart; |
||
45 | use ReferenceReturnPart; |
||
46 | use TypeDocblockGeneratorPart; |
||
47 | use TypePart; |
||
48 | |||
49 | /** |
||
50 | * Creates a PHP function from reflection |
||
51 | * |
||
52 | * @deprecated will be removed in version 0.5 |
||
53 | * @param \ReflectionFunction $ref |
||
54 | * @return PhpFunction |
||
55 | */ |
||
56 | public static function fromReflection(\ReflectionFunction $ref) { |
||
57 | $function = self::create($ref->name) |
||
58 | ->setReferenceReturned($ref->returnsReference()) |
||
59 | ->setBody(ReflectionUtils::getFunctionBody($ref)); |
||
60 | |||
61 | $docblock = new Docblock($ref); |
||
62 | $function->setDocblock($docblock); |
||
63 | $function->setDescription($docblock->getShortDescription()); |
||
64 | $function->setLongDescription($docblock->getLongDescription()); |
||
65 | |||
66 | foreach ($ref->getParameters() as $refParam) { |
||
67 | assert($refParam instanceof \ReflectionParameter); // hmm - assert here? |
||
68 | |||
69 | $param = PhpParameter::fromReflection($refParam); |
||
1 ignored issue
–
show
|
|||
70 | $function->addParameter($param); |
||
71 | } |
||
72 | |||
73 | return $function; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Creates a new PHP function |
||
78 | * |
||
79 | * @param string $name qualified name |
||
80 | * @return static |
||
81 | */ |
||
82 | 7 | public static function create($name = null) { |
|
85 | |||
86 | /** |
||
87 | * Creates a new PHP function |
||
88 | * |
||
89 | * @param string $name qualified name |
||
90 | */ |
||
91 | 10 | public function __construct($name = null) { |
|
96 | |||
97 | /** |
||
98 | * @inheritDoc |
||
99 | */ |
||
100 | 3 | public function generateDocblock() { |
|
111 | } |
||
112 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.