Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created August 26, 2015 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredemmott/f47ae29c99d38452505c to your computer and use it in GitHub Desktop.
Save fredemmott/f47ae29c99d38452505c to your computer and use it in GitHub Desktop.
---
sources:
-
type: file
name: >
/home/fred/hhvm/hphp/runtime/ext/enum/ext_enum.php
mtime: 1438030742
-
type: file
name: >
/home/fred/hhvm/hphp/hack/hhi/BuiltinEnum.hhi
mtime: 1438030742
type: class
data:
name: HH\BuiltinEnum
methods:
-
name: getValues
returnType:
typename: array
genericTypes:
-
typename: string
genericTypes: [ ]
-
typename: T
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Get the values of the public consts defined on this class,
* indexed by the string name of those consts.
*
* @return array ('CONST_NAME' => $value, ....)
*/
parameters: [ ]
-
name: getNames
returnType:
typename: array
genericTypes:
-
typename: T
genericTypes: [ ]
-
typename: string
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Get the names of all the const values, indexed by value. Calls
* invariant_exception if multiple constants have the same value.
*
* @return array($value => 'CONST_NAME', ....)
*/
parameters: [ ]
-
name: isValid
returnType:
typename: bool
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Returns whether or not the value is defined as a constant.
*/
parameters:
-
name: value
typehint:
typename: mixed
genericTypes: [ ]
isVariadic: false
isPassedByReference: false
isOptional: false
default: null
-
name: coerce
returnType:
typename: T
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Coerce to a valid value or null.
* This is useful for typing deserialized enum values.
*/
parameters:
-
name: value
typehint:
typename: mixed
genericTypes: [ ]
isVariadic: false
isPassedByReference: false
isOptional: false
default: null
-
name: assert
returnType:
typename: T
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Coerce to valid value or throw UnexpectedValueException
* This is useful for typing deserialized enum values.
*/
parameters:
-
name: value
typehint:
typename: mixed
genericTypes: [ ]
isVariadic: false
isPassedByReference: false
isOptional: false
default: null
-
name: assertAll
returnType:
typename: Container
genericTypes:
-
typename: T
genericTypes: [ ]
generics: [ ]
docComment: |
/**
* Coerce all the values in a traversable. If the value is not an
* array of valid items, an UnexpectedValueException is thrown
*/
parameters:
-
name: values
typehint:
typename: Traversable
genericTypes:
-
typename: mixed
genericTypes: [ ]
isVariadic: false
isPassedByReference: false
isOptional: false
default: null
generics:
-
name: T
constraint: null
parent: null
interfaces: [ ]
docComment: |
/**
* BuiltinEnum contains the utility methods provided by enums.
* Under the hood, an enum Foo will extend BuiltinEnum<Foo>.
*
* HHVM provides a native implementation for this class. The PHP class
* definition below is not actually used at run time; it is simply
* provided for the typechecker and for developer reference.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment