Fix type hint bugs from scrutinizer
Fix phpstorm inspection errors