No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / trait_require_syntax.php
blobf963b4384f737bfcd46218c5d2ab0d04f737b076
1 <?hh // partial
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
12 interface I1 {
13 const int ICONST = 1;
15 public function baz(): void;
18 interface I2 extends I1 {}
20 class Super {
21 protected function foo(): void {
22 echo __METHOD__, "\n";
26 trait Trait1 {
27 require extends Super;
28 require implements I1;
30 public function bar(): void {
31 echo '[', self::ICONST, ']', "\n";
32 $this->foo();
33 $this->baz();
36 // <<__Override>> // FIXME: check without a use class?
37 // protected function override_me(): void {}
40 trait Trait2 {
41 use Trait1; // Requirements of Trait1 inherited
43 protected function f() {
44 return $this->foo();
46 protected function g() {
47 return $this->baz();
51 class C
52 extends Super
53 implements I2
55 use Trait2;
57 public function baz(): void {
58 echo "baz", "\n";