Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

final class Filesystem {
public static function createTemporaryFile(
string $prefix = '',
Expand Down
2 changes: 2 additions & 0 deletions lib/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

final class Str {
public static function explode(
string $delimiter,
Expand Down
2 changes: 2 additions & 0 deletions lib/StrBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

class StrBuffer {

private string $str = '';
Expand Down
2 changes: 2 additions & 0 deletions lib/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Remove the 'HH\' prefix from typehint strings
* and from strings produced by var_export().
Expand Down
2 changes: 2 additions & 0 deletions src/BaseCodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

abstract class BaseCodeBuilder implements ICodeBuilder {

const string DELIMITER = "\t";
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a class. Please don't use this class directly; instead use
* the function codegen_class. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenClassBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Abstract class to generate code for a class or trait.
*
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a constructor. E.g.
*
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for an enum. Please don't use this class directly; instead use
* the function codegen_enum. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

enum CodegenFileResult: int {
NONE = 0;
UPDATE = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a function. Please don't use this class directly; instead
* use the function codegen_function. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenFunctionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Base class to generate a function or a method.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenGeneratedFrom.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Describes how the code was generated in order to write a comment on
* the generated file.
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenImplementsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Describes an implemented interface, optionally including a comment, like:
*
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for an interface. Please don't use this class directly; instead
* use the function codegen_interface. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenMemberVar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a member variable. Please don't use this class directly;
* instead use the function codegen_member_var. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a method. Please don't use this class directly; instead use
* the function codegen_method. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenMethodBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Base class to generate a method or a constructor.
* See CodegenMethod or CodegenConstructor
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a shape. Please don't use this class directly; instead use
* the function codegen_shape. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a trait. Please don't use this class directly; instead use
* the function codegen_trait. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Generate code for a type or newtype definition. Please don't use this class
* directly; instead use the functions codegen_type or codegen_newtype. E.g.:
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenUsesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Describe an used trait, optionally including a comment, like:
*
Expand Down
2 changes: 2 additions & 0 deletions src/CodegenWithVisibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

enum CodegenPHPMethodVisibility : string as string {
V_PUBLIC = 'public';
V_PRIVATE = 'private';
Expand Down
2 changes: 2 additions & 0 deletions src/HackBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Class to facilitate building code. It has methods for some common patterns
* used to generate code. It also deals with indentation and new lines.
Expand Down
2 changes: 2 additions & 0 deletions src/HackBuilderKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

enum HackBuilderKeys : int {
// The key will be used literally, which is useful for example when
// passing a constant such as MyEnum::Value
Expand Down
2 changes: 2 additions & 0 deletions src/HackBuilderRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Use this trait along with an implementation of ICodeBuilderRenderer.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/HackBuilderValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

enum HackBuilderValues : int {
// The value will be used literally, which is useful for example when
// passing a constant such as MyEnum::Value
Expand Down
2 changes: 2 additions & 0 deletions src/HackCodegenConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* This class contains the default configuration for Hack code generation.
* Please update it to your needs.
Expand Down
2 changes: 2 additions & 0 deletions src/ICodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

interface ICodeBuilder {
}
2 changes: 2 additions & 0 deletions src/ICodeBuilderRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

interface ICodeBuilderRenderer {
/**
* Appends the code of this class to the builder
Expand Down
2 changes: 2 additions & 0 deletions src/ICodegenFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Implement this interface to define a class to format a file after the
* code is generated.
Expand Down
2 changes: 2 additions & 0 deletions src/IHackCodegenConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Implement this interface to define a configuration to generate code.
* The config will need to be passed to some of the Codegen constructors,
Expand Down
2 changes: 2 additions & 0 deletions src/PartiallyGeneratedCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Manage partially generated code. The main operation is to merge existing
* code (that probably has some handwritten code) with generated code.
Expand Down
2 changes: 2 additions & 0 deletions src/PartiallyGeneratedSignedSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;


/**
* Similar to SignedSource, but it uses a different header to indicate that the
Expand Down
2 changes: 2 additions & 0 deletions src/SignedSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* Designate machine-generated code so tools can distinguish it from
* human-generated code, and prevent manual edits of machine-generated code by
Expand Down
2 changes: 2 additions & 0 deletions src/SignedSourceBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

abstract class SignedSourceBase {

const TOKEN ='<<SignedSource::*O*zOeWoEQle#+L!plEphiEmie@I>>';
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

abstract class CodegenBaseTest {

public static function assertTrue(
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenClassTestCase.codegen
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class ClassWithGenerics
> {
}

namespace Facebook/HackCodegen;

!@#$%codegentest:testConstructorWrapperFunc
function TestWrapperFunc(string $text, ?bool $hack): TestWrapperFunc {
return new TestWrapperFunc($text, $hack);
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenClassTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

final class CodegenClassTestCase extends CodegenBaseTest {

public function testDocblock() {
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenEnumTestCase.codegen
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ enum Demo : string {
* This is a different letter
*/
B = 'b';
namespace Facebook/HackCodegen;

}

!@#$%codegentest:testDocblock
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenEnumTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

final class CodegenEnumTestCase extends CodegenBaseTest {

public function testDocblock() {
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenExpectedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

/**
* The main purposes of this class are to:
* 1) Serialize a Map<string,string> into a file.
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenFileTestCase.codegen
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Completely autogenerated!
*
* @-generated SignedSource<<38687075d6c73650c6f1db0ddc0289b1>>
namespace Facebook/HackCodegen;

*/

class AllAutogenerated {
Expand Down
2 changes: 2 additions & 0 deletions test/CodegenFileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

namespace Facebook/HackCodegen;

final class CodegenFileTestCase extends CodegenBaseTest {


Expand Down
Loading