3 * Copyright (c) 2014, Facebook, Inc.
6 * This source code is licensed under the BSD-style license found in the
7 * LICENSE file in the "hack" directory of this source tree. An additional grant
8 * of patent rights can be found in the PATENTS file in the same directory.
12 // A simple duck typing example
16 public function render(): string {
23 public function otherStuff(): string {
24 return "I know how to do other stuff too!";
27 public function render(string $x = ""): string {
28 return "Yoohoo I know how to render";
32 function test(DoesRender
$obj): string {
33 return $obj->render();
36 function main(): void
{
37 $my_string = test(new MyClass1());