From a4bdca55e925601be97f8033374603607cf5b1b0 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 5 May 2017 19:56:45 -0400 Subject: [PATCH] Fix sscanf test with new types --- tests/TypeReconciliationTest.php | 92 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/TypeReconciliationTest.php b/tests/TypeReconciliationTest.php index 3376dc049..30b616a7a 100644 --- a/tests/TypeReconciliationTest.php +++ b/tests/TypeReconciliationTest.php @@ -237,14 +237,14 @@ class TypeReconciliationTest extends TestCase ' [ ' [ ' [ 'foo = new B(); } } - + $a = new A(); - + $out = null; - + if ($a->foo instanceof C) { // do something } @@ -337,18 +337,18 @@ class TypeReconciliationTest extends TestCase 'notInstanceOfPropertyElseif' => [ 'foo)) { - + } elseif ($a->foo instanceof C) { // do something @@ -376,9 +376,9 @@ class TypeReconciliationTest extends TestCase ['int' => '$a'], ['int' => '$b'], ['string' => '$c'], - ['string' => '$hours'], - ['string' => '$minutes'], - ['string' => '$seconds'] + ['string|int|float' => '$hours'], + ['string|int|float' => '$minutes'], + ['string|int|float' => '$seconds'] ] ], 'typeRefinementWithIsNumeric' => [ @@ -387,7 +387,7 @@ class TypeReconciliationTest extends TestCase function fooFoo(string $a) { if (is_numeric($a)) { } } - + $b = rand(0, 1) ? 5 : false; if (is_numeric($b)) { }' ], @@ -408,7 +408,7 @@ class TypeReconciliationTest extends TestCase ' [ ' [ @@ -471,11 +471,11 @@ class TypeReconciliationTest extends TestCase } elseif (empty($a)) { return "goodbye"; } - + if (isset($a[0])) { return $a[0]; }; - + return "not found"; }' ], @@ -490,11 +490,11 @@ class TypeReconciliationTest extends TestCase } elseif (empty($a)) { return "goodbye"; } - + if (is_string($a)) { return $a; }; - + return "an exception"; }' ], @@ -509,7 +509,7 @@ class TypeReconciliationTest extends TestCase } elseif (empty($a)) { return "goodbye"; } - + return $a->getMessage(); }' ], @@ -525,7 +525,7 @@ class TypeReconciliationTest extends TestCase } elseif (is_int($a)) { return $a; } - + throw new \LogicException("Runtime error"); }' ], @@ -575,7 +575,7 @@ class TypeReconciliationTest extends TestCase 'bar(); $this->bat(); - + takesA($this); takesI($this); } } - + protected function bar() : void {} } - + class B extends A implements I { public function bat() : void {} }' @@ -661,7 +661,7 @@ class TypeReconciliationTest extends TestCase 'failedTypeResolution' => [ ' [ ' [ ' [ '