phpstan 0.12.58

This commit is contained in:
Dylan K. Taylor
2020-11-30 22:11:43 +00:00
parent 3709ba172b
commit 215bac8dd7
3 changed files with 12 additions and 9 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\permission;
use pocketmine\utils\AssumptionFailedError;
use function array_shift;
use function count;
use function explode;
@ -145,7 +146,9 @@ class BanEntry{
private static function parseDate(string $date) : \DateTime{
$datetime = \DateTime::createFromFormat(self::$format, $date);
if(!($datetime instanceof \DateTime)){
throw new \RuntimeException("Error parsing date for BanEntry: " . implode(", ", \DateTime::getLastErrors()["errors"]));
$lastErrors = \DateTime::getLastErrors();
if($lastErrors === false) throw new AssumptionFailedError("DateTime::getLastErrors() should not be returning false in here");
throw new \RuntimeException("Error parsing date for BanEntry: " . implode(", ", $lastErrors["errors"]));
}
return $datetime;