Emit fatal when unit takes a reference to a local superglobal
[hiphop-php.git] / hphp / hack / hhi / reflection.hhi
blob498cae1a31f5c9d202b43587bdeaea04b3352782
1 <?hh /* -*- mode: php -*- */
2 /**
3  * Copyright (c) 2014, Facebook, Inc.
4  * All rights reserved.
5  *
6  * This source code is licensed under the MIT license found in the
7  * LICENSE file in the "hack" directory of this source tree.
8  *
9  */
11 interface Reflector {
12   <<__Rx, __MaybeMutable>>
13   public function __toString();
16 class Reflection  {
17   <<__Rx>>
18   public static function getModifierNames($modifiers);
19   public static function export(Reflector $reflector, $return = false);
22 class ReflectionClass implements Reflector {
24   const int IS_IMPLICIT_ABSTRACT = 16;
25   const int IS_EXPLICIT_ABSTRACT = 32;
26   const int IS_FINAL = 64;
28   /**
29    * This field is read-only
30    */
31   public string $name;
33   <<__Rx>>
34   public function __construct(<<__MaybeMutable>> mixed $argument);
35   public static function export(mixed $argument, bool $return = false): ?string;
36   <<__Rx, __MaybeMutable>>
37   public function getConstant(string $name): mixed;
38   <<__Rx, __MaybeMutable>>
39   public function getConstants(): darray<string, mixed>;
40   <<__Rx, __MaybeMutable>>
41   public function getAbstractConstantNames(): darray<string, string>;
42   <<__Rx, __MaybeMutable>>
43   public function getTypeConstant(string $name): ReflectionTypeConstant;
44   <<__Rx, __MaybeMutable>>
45   public function getTypeConstants(): varray<ReflectionTypeConstant>;
46   <<__Rx, __MaybeMutable>>
47   public function getConstructor(): ?ReflectionMethod;
48   <<__Rx, __MaybeMutable>>
49   public function getDefaultProperties(): darray<string, mixed>;
50   /**
51    * Returns string or false
52    */
53   <<__Rx, __MaybeMutable>>
54   public function getDocComment(): mixed;
55   <<__Rx, __MaybeMutable>>
56   public function getEndLine(): int;
57   <<__Rx, __MaybeMutable>>
58   public function getExtension(): ?ReflectionExtension;
59   <<__Rx, __MaybeMutable>>
60   public function getExtensionName(): string;
61   /**
62    * Returns string or false
63    */
64   <<__Rx, __MaybeMutable>>
65   public function getFileName(): mixed;
66   <<__Rx, __MaybeMutable>>
67   public function getFile(): ReflectionFile;
68   <<__Rx, __MaybeMutable>>
69   public function getInterfaceNames(): varray<string>;
70   <<__Rx, __MaybeMutable>>
71   public function getInterfaces(): darray<string, ReflectionClass>;
72   <<__Rx, __MaybeMutable>>
73   final public function getAttributes(): darray<string, varray<mixed>>;
74   <<__Rx, __MaybeMutable>>
75   final public function getAttribute(string $name): ?varray<mixed>;
76   <<__Rx, __MaybeMutable>>
77   final public function getAttributeClass<T as HH\ClassLikeAttribute>(classname<T> $c): ?T;
78   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributesRecursive(): darray<string, varray<mixed>>;
79   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributeRecursive(string $name): ?varray<mixed>;
80   <<__Rx, __MaybeMutable>>
81   public function getMethod(string $name): ReflectionMethod;
82   <<__Rx, __MaybeMutable>>
83   public function getMethods(?int $filter = null): varray<ReflectionMethod>;
84   <<__Rx, __MaybeMutable>>
85   public function getModifiers(): int;
86   <<__Rx, __MaybeMutable>>
87   public function getName(): string;
88   <<__Rx, __MaybeMutable>>
89   public function getNamespaceName(): string;
90   /**
91    * Returns ReflectionClass or false
92    */
93   <<__Rx, __MaybeMutable>>
94   public function getParentClass(): mixed;
95   <<__Rx, __MaybeMutable>>
96   public function getProperties(int $filter = 0xFFFF): varray<ReflectionProperty>;
97   <<__Rx, __MaybeMutable>>
98   public function getProperty(string $name): ReflectionProperty;
99   <<__Rx, __MaybeMutable>>
100   public function getRequirementNames(): varray<string>;
101   <<__Rx, __MaybeMutable>>
102   public function getRequirements(): darray<string, ReflectionClass>;
103   <<__Rx, __MaybeMutable>>
104   public function getShortName(): string;
105   <<__Rx, __MaybeMutable>>
106   public function getStartLine(): int;
107   public function getStaticProperties(): darray<string, mixed>;
108   public function getStaticPropertyValue(string $name, mixed $def_value = null): mixed;
109   <<__Rx, __MaybeMutable>>
110   public function getTraitAliases(): darray<string, string>;
111   <<__Rx, __MaybeMutable>>
112   public function getTraitNames(): varray<string>;
113   <<__Rx, __MaybeMutable>>
114   public function getTraits(): darray<string, ReflectionClass>;
115   <<__Rx, __MaybeMutable>>
116   public function hasConstant(string $name): bool;
117   <<__Rx, __MaybeMutable>>
118   public function hasMethod(string $name): bool;
119   <<__Rx, __MaybeMutable>>
120   public function hasProperty(string $name): bool;
121   <<__Rx, __MaybeMutable>>
122   public function hasTypeConstant(string $name): bool;
123   <<__Rx, __MaybeMutable>>
124   public function implementsInterface(string $interface): bool;
125   <<__Rx, __MaybeMutable>>
126   public function inNamespace(): bool;
127   <<__Rx, __MaybeMutable>>
128   public function isAbstract(): bool;
129   <<__Rx, __MaybeMutable>>
130   public function isCloneable(): bool;
131   <<__Rx, __MaybeMutable>>
132   public function isFinal(): bool;
133   <<__Rx, __MaybeMutable>>
134   public function isInstance(<<__MaybeMutable>> mixed $object): bool;
135   <<__Rx, __MaybeMutable>>
136   public function isInstantiable(): bool;
137   <<__Rx, __MaybeMutable>>
138   public function isInterface(): bool;
139   <<__Rx, __MaybeMutable>>
140   public function isEnum(): bool;
141   <<__Rx, __MaybeMutable>>
142   public function isInternal(): bool;
143   <<__Rx, __MaybeMutable>>
144   public function isIterateable(): bool;
145   /**
146    * $class is string or ReflectionClass
147    */
148   <<__Rx, __MaybeMutable>>
149   public function isSubclassOf(mixed $class): bool;
150   <<__Rx, __MaybeMutable>>
151   public function isTrait(): bool;
152   <<__Rx, __MaybeMutable>>
153   public function isUserDefined(): bool;
154   public function newInstance(...$args);
155   public function newInstanceArgs(Traversable<mixed> $args = varray[]);
156   public function newInstanceWithoutConstructor();
157   public function setStaticPropertyValue(string $name, mixed $value): void;
158   <<__Rx, __MaybeMutable>>
159   public function __toString(): string;
162 class ReflectionObject extends ReflectionClass {}
164 class ReflectionException extends Exception {}
166 abstract class ReflectionFunctionAbstract implements Reflector {
168   public $name = '';
170   // Methods
171   <<__Rx, __MaybeMutable>>
172   public function getName(): string;
173   <<__Rx, __MaybeMutable>>
174   public function inNamespace(): bool;
175   <<__Rx, __MaybeMutable>>
176   public function getNamespaceName(): string;
177   <<__Rx, __MaybeMutable>>
178   public function getShortName(): string;
179   <<__Rx, __MaybeMutable>>
180   public function isHack(): bool;
181   <<__Rx, __MaybeMutable>>
182   public function isInternal(): bool;
183   <<__Rx, __MaybeMutable>>
184   public function isClosure(): bool;
185   <<__Rx, __MaybeMutable>>
186   public function isGenerator(): bool;
187   <<__Rx, __MaybeMutable>>
188   public function isAsync(): bool;
189   <<__Rx, __MaybeMutable>>
190   public function isVariadic(): bool;
191   <<__Rx, __MaybeMutable>>
192   public function isUserDefined(): bool;
193   <<__Rx, __MaybeMutable>>
194   public function getFileName(): mixed; // string | false
195   <<__Rx, __MaybeMutable>>
196   public function getFile(): ReflectionFile;
197   <<__Rx, __MaybeMutable>>
198   public function getStartLine(): mixed; // int | false
199   <<__Rx, __MaybeMutable>>
200   public function getEndLine(): mixed; // int | false
201   <<__Rx, __MaybeMutable>>
202   public function getDocComment(): mixed; // string | false
203   public function getStaticVariables(): darray<string, mixed>;
204   <<__Rx, __MaybeMutable>>
205   public function returnsReference(): bool;
206   <<__Rx, __MaybeMutable>>
207   public function getReturnTypeText();
208   <<__Rx, __MaybeMutable>>
209   final public function getAttributes(): darray<string, varray<mixed>>;
210   <<__Rx, __MaybeMutable>>
211   final public function getAttribute(string $name): ?varray<mixed>;
212   <<__Rx, __MaybeMutable>>
213   public function getNumberOfParameters(): int;
214   <<__Rx, __MaybeMutable>>
215   public function getParameters(): varray<ReflectionParameter>;
216   <<__Rx, __MaybeMutable>>
217   public function getNumberOfRequiredParameters();
218   <<__Rx, __MaybeMutable>>
219   public function isDeprecated(): bool;
220   <<__Rx, __MaybeMutable>>
221   public function getExtension();
222   <<__Rx, __MaybeMutable>>
223   public function getExtensionName();
224   final private function __clone();
225   <<__Rx, __MaybeMutable>>
226   public function hasReturnType(): bool;
227   <<__Rx, __MaybeMutable>>
228   public function getReturnType(): ?ReflectionType;
231 class ReflectionFunction extends ReflectionFunctionAbstract implements Reflector {
232   const IS_DEPRECATED = 262144;
234   public $name = '';
236   <<__Rx>>
237   public function __construct($name);
238   <<__Rx, __MaybeMutable>>
239   public function __toString();
240   public static function export($name, $return = null);
241   <<__Rx, __MaybeMutable>>
242   public function isDisabled();
243   public function invoke(...);
244   public function invokeArgs(varray $args);
245   public function getClosure();
246   <<__Rx, __MaybeMutable>>
247   final public function getAttributeClass<T as HH\FunctionAttribute>(classname<T> $c): ?T;
250 class ReflectionMethod extends ReflectionFunctionAbstract implements Reflector {
251   // Constants
252   const IS_STATIC    = 1;
253   const IS_PUBLIC    = 256;
254   const IS_PROTECTED = 512;
255   const IS_PRIVATE   = 1024;
256   const IS_ABSTRACT  = 2;
257   const IS_FINAL     = 4;
259   public $name = '';
260   public $class = '';
262   public static function export(string $class, string $name, bool $return = false);
263   <<__Rx>>
264   public function __construct($class, $name = null);
265   <<__Rx, __MaybeMutable>>
266   public function __toString();
267   <<__Rx, __MaybeMutable>>
268   public function isPublic();
269   <<__Rx, __MaybeMutable>>
270   public function isPrivate();
271   <<__Rx, __MaybeMutable>>
272   public function isProtected();
273   <<__Rx, __MaybeMutable>>
274   public function isAbstract();
275   <<__Rx, __MaybeMutable>>
276   public function isFinal();
277   <<__Rx, __MaybeMutable>>
278   public function isStatic();
279   <<__Rx, __MaybeMutable>>
280   public function isConstructor();
281   public function getClosure($object);
282   <<__Rx, __MaybeMutable>>
283   public function getModifiers();
284   public function invoke($object, ...);
285   public function invokeArgs($object, varray $args);
286   <<__Rx, __MaybeMutable>>
287   public function getDeclaringClass();
288   <<__Rx, __MaybeMutable>>
289   public function getPrototype();
290   public function setAccessible(bool $accessible);
291   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributesRecursive(): darray<string, varray<mixed>>;
292   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributeRecursive(string $name): ?varray<mixed>;
293   <<__Rx, __MaybeMutable>>
294   final public function getAttributeClass<T as HH\MethodAttribute>(classname<T> $c): ?T;
297 class ReflectionParameter implements Reflector {
298   public $name = '';
300   final private function __clone();
301   public static function export($function, $parameter, $return = null);
302   <<__Rx>>
303   public function __construct($function, $parameter);
304   <<__Rx, __MaybeMutable>>
305   public function __toString();
306   <<__Rx, __MaybeMutable>>
307   public function getName();
308   <<__Rx, __MaybeMutable>>
309   public function isPassedByReference();
310   <<__Rx, __MaybeMutable>>
311   public function isInOut(): bool;
312   <<__Rx, __MaybeMutable>>
313   public function canBePassedByValue();
314   <<__Rx, __MaybeMutable>>
315   public function getDeclaringFunction();
316   <<__Rx, __MaybeMutable>>
317   public function getDeclaringClass();
318   <<__Rx, __MaybeMutable>>
319   public function getClass();
320   <<__Rx, __MaybeMutable>>
321   public function isArray();
322   <<__Rx, __MaybeMutable>>
323   public function isCallable();
324   <<__Rx, __MaybeMutable>>
325   public function allowsNull();
326   <<__Rx, __MaybeMutable>>
327   public function getPosition();
328   <<__Rx, __MaybeMutable>>
329   public function isOptional();
330   <<__Rx, __MaybeMutable>>
331   public function isDefaultValueAvailable();
332   <<__Rx, __MaybeMutable>>
333   public function getDefaultValue();
334   <<__Rx, __MaybeMutable>>
335   public function isDefaultValueConstant();
336   <<__Rx, __MaybeMutable>>
337   public function getDefaultValueConstantName();
338   <<__Rx, __MaybeMutable>>
339   public function getTypehintText();
340   <<__Rx, __MaybeMutable>>
341   public function getTypeText(): string;
342   <<__Rx, __MaybeMutable>>
343   public function getDefaultValueText();
344   <<__Rx, __MaybeMutable>>
345   public function isVariadic();
346   <<__Rx, __MaybeMutable>>
347   public function hasType(): bool;
348   <<__Rx, __MaybeMutable>>
349   public function getType(): ?ReflectionType;
350   <<__Rx, __MaybeMutable>>
351   final public function getAttribute(string $name): ?varray<mixed>;
352   <<__Rx, __MaybeMutable>>
353   final public function getAttributeClass<T as HH\ParameterAttribute>(classname<T> $c): ?T;
354   <<__Rx, __MaybeMutable>>
355   final public function getAttributes(): darray<string, varray<mixed>>;
356   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributeRecursive(string $name);
357   <<__Deprecated("This function is being removed as it has been broken for some time")>> final public function getAttributesRecursive();
360 class ReflectionProperty implements Reflector {
361   const IS_STATIC = 1;
362   const IS_PUBLIC = 256;
363   const IS_PROTECTED = 512;
364   const IS_PRIVATE = 1024;
366   public $name = '';
367   public $class = '';
369   final private function __clone();
370   public static function export($class, $name, $return = null);
371   <<__Rx>>
372   public function __construct($class, string $name);
373   <<__Rx, __MaybeMutable>>
374   public function __toString();
375   <<__Rx, __MaybeMutable>>
376   public function getName();
377   public function getValue($object = null);
378   public function setValue($object, $value = null);
379   <<__Rx, __MaybeMutable>>
380   public function isPublic();
381   <<__Rx, __MaybeMutable>>
382   public function isPrivate();
383   <<__Rx, __MaybeMutable>>
384   public function isProtected();
385   <<__Rx, __MaybeMutable>>
386   public function isStatic();
387   <<__Rx, __MaybeMutable>>
388   public function isDefault();
389   <<__Rx, __MaybeMutable>>
390   public function getModifiers();
391   <<__Rx, __MaybeMutable>>
392   public function getDeclaringClass();
393   <<__Rx, __MaybeMutable>>
394   public function getDocComment();
395   public function setAccessible($accessible);
396   <<__Rx, __MaybeMutable>>
397   public function getTypeText();
398   public function getAttributes(): darray<string, varray<mixed>>;
399   public function getAttribute(string $name): ?varray<mixed>;
402 class ReflectionExtension implements Reflector {
404   public $name = '';
406   final private function __clone();
407   public static function export($name, $return = false);
408   <<__Rx>>
409   public function __construct($name);
410   <<__Rx, __MaybeMutable>>
411   public function __toString();
412   <<__Rx, __MaybeMutable>>
413   public function getName();
414   <<__Rx, __MaybeMutable>>
415   public function getVersion();
416   <<__Rx, __MaybeMutable>>
417   public function getFunctions();
418   <<__Rx, __MaybeMutable>>
419   public function getConstants();
420   <<__Rx, __MaybeMutable>>
421   public function getINIEntries();
422   <<__Rx, __MaybeMutable>>
423   public function getClasses();
424   <<__Rx, __MaybeMutable>>
425   public function getClassNames();
426   <<__Rx, __MaybeMutable>>
427   public function info();
430 class ReflectionTypeConstant implements Reflector {
432   final private function __clone();
433   public static function export($class, string $name, $return = null);
434   <<__Rx>>
435   public function __construct($class, string $name);
436   <<__Rx, __MaybeMutable>>
437   public function __toString(): string;
438   <<__Rx, __MaybeMutable>>
439   public function getName(): string;
440   <<__Rx, __MaybeMutable>>
441   public function isAbstract(): bool;
442   <<__Rx, __MaybeMutable>>
443   public function getDeclaringClass(): ReflectionClass;
444   <<__Rx, __MaybeMutable>>
445   public function getClass(): ReflectionClass;
446   <<__Rx, __MaybeMutable>>
447   public function getAssignedTypeText(): ?string;
450 class ReflectionTypeAlias implements Reflector {
451   final private function __clone();
452   <<__Rx>>
453   final public function __construct(string $name);
454   <<__Rx, __MaybeMutable>>
455   public function __toString(): string;
456   <<__Rx, __MaybeMutable>>
457   public function getTypeStructure(): darray;
458   <<__Rx, __MaybeMutable>>
459   public function getResolvedTypeStructure(): darray;
460   <<__Rx, __MaybeMutable>>
461   public function getAssignedTypeText(): string;
462   <<__Rx, __MaybeMutable>>
463   public function getName(): string;
464   <<__Rx, __MaybeMutable>>
465   public function getFileName(): string;
466   <<__Rx, __MaybeMutable>>
467   public function getFile(): ReflectionFile;
468   <<__Rx, __MaybeMutable>>
469   final public function getAttributes(): darray<string, varray<mixed>>;
470   <<__Rx, __MaybeMutable>>
471   final public function getAttribute(string $name): ?varray<mixed>;
472   <<__Rx, __MaybeMutable>>
473   final public function getAttributeClass<T as HH\TypeAliasAttribute>(classname<T> $c): ?T;
476 class ReflectionType {
477   final private function __clone();
478   <<__Rx>>
479   public function __construct(?Reflector $param_or_ret = null,
480                               darray $type_hint_info = darray[]);
481   <<__Rx, __MaybeMutable>>
482   public function allowsNull(): bool;
483   <<__Rx, __MaybeMutable>>
484   public function isBuiltin(): bool;
485   <<__Rx, __MaybeMutable>>
486   public function __toString(): string;
489 class ReflectionFile implements Reflector {
490   final private function __clone();
491   <<__Rx>>
492   final public function __construct(string $name);
493   <<__Rx, __MaybeMutable>>
494   public function __toString(): string;
495   <<__Rx, __MaybeMutable>>
496   public function getName(): string;
497   <<__Rx, __MaybeMutable>>
498   final public function getAttributes(): darray<string, varray<mixed>>;
499   <<__Rx, __MaybeMutable>>
500   final public function getAttribute(string $name): ?varray<mixed>;
501   <<__Rx, __MaybeMutable>>
502   final public function getAttributeClass<T as HH\FileAttribute>(classname<T> $c): ?T;