The expression return $root could return the type null which is incompatible with the type-hinted return leetcode\util\TreeNode. Consider adding an additional type-check to rule them out.
The expression return $root could return the type null which is incompatible with the type-hinted return leetcode\util\TreeNode. Consider adding an additional type-check to rule them out.