From 4d676afaef0301b0909eb4b6a2b36728039aaf16 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 7 Sep 2018 11:01:10 -0400 Subject: [PATCH] Fix #985 - strip null from object type where possible --- src/Psalm/Type/Reconciler.php | 1 + tests/TypeReconciliationTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index a8070f35b..04d9b24b7 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -448,6 +448,7 @@ class Reconciler foreach ($existing_var_atomic_types as $type_key => $type) { if ($type instanceof TNamedObject + || $type instanceof TObject || $type instanceof TResource || $type instanceof TCallable ) { diff --git a/tests/TypeReconciliationTest.php b/tests/TypeReconciliationTest.php index 7d1cca9d3..e49222941 100644 --- a/tests/TypeReconciliationTest.php +++ b/tests/TypeReconciliationTest.php @@ -1019,6 +1019,16 @@ class TypeReconciliationTest extends TestCase echo substr($_SERVER["abc"], 1, 2); }', ], + 'notObject' => [ + '