Skip to content

Instantly share code, notes, and snippets.

@marcioAlmada
Created November 17, 2015 01:44
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 marcioAlmada/7dee0f27dcdb201d26ec to your computer and use it in GitHub Desktop.
Save marcioAlmada/7dee0f27dcdb201d26ec to your computer and use it in GitHub Desktop.
second order macros FTR
--TEST--
Opaque types with macros that generate other macros :>
--FILE--
<?php
macro {
type T_STRING·newtype = T_STRING·basetype;
} >> {
macro { T_STRING·newtype } >> { T_STRING·basetype }
}
type Username = string;
type Password = string;
function register_user(Username $nickname, Password $password) : User {
//...
}
?>
--EXPECTF--
<?php
function register_user(string $nickname, string $password) : User {
//...
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment