Fix errors found by PHPStan
Test Plan:
Ran phpstan analyze --autoload-file=src/__phutil_library_init__.php -c phpstan.neon -l 1 src/ with phpstan.neon containing:
parameters: excludes_analyse: - */__tests__/*
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D17364