Check for void/noreturn in conditionals
[hiphop-php.git] / hphp / hack / test / typecheck / try_catch.php
blobddce23f156e79b4eccb3d04b8e24c7b383a1dee9
1 <?hh
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
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 function terminal_catch_can_do_whatever(): int {
13 $a = 23;
14 try {
15 $a = 456;
16 } catch (YourException $e) {
17 return $a;
18 } catch (MyException $e) {
19 // It is ok to make this a string, since this clause is terminal
20 $a = 'duck';
21 return 23904;
22 } catch (Exception $e) {
23 return $a;
25 return $a;