forked from hhvm/hack-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodegenMethod.php
More file actions
32 lines (30 loc) · 931 Bytes
/
CodegenMethod.php
File metadata and controls
32 lines (30 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?hh // strict
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/**
* Generate code for a method. Please don't use this class directly; instead use
* the function codegen_method. E.g.:
*
* codegen_method('justDoIt')
* ->addParameter('int $x = 3')
* ->setReturnType('string')
* ->setBody('return (string) $x;')
* ->setProtected()
* ->render();
*
*/
final class CodegenMethod extends CodegenMethodBase {
}
/* HH_FIXME[4033] variadic params with type constraints are not supported */
function codegen_method(string $name, ...$args): CodegenMethod {
return new CodegenMethod(
HackCodegenConfig::getInstance(),
vsprintf($name, $args),
);
}