3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?hh type PointA<T> = shape ('x' => T, 'y' => T); function demo1(PointA<T> $pt1){} // do stufff - general case type PointB<int> = shape ('x' => int, 'y' => int); function demo2(PointB<int> $pt1) {} // special case for Point of type int only type PointC<int> = shape('x' => int, 'y' => 0); function demo3(PointC<int> $pt1) {} // special case for Point of type int where y is 0
Output for 5.3.0 - 5.4.32
<?hh type PointA<T> = shape ('x' => T, 'y' => T); function demo1(PointA<T> $pt1){} // do stufff - general case type PointB<int> = shape ('x' => int, 'y' => int); function demo2(PointB<int> $pt1) {} // special case for Point of type int only type PointC<int> = shape('x' => int, 'y' => 0); function demo3(PointC<int> $pt1) {} // special case for Point of type int where y is 0