Make use of Utils::assumeNotFalse() in a bunch of places

I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
This commit is contained in:
Dylan K. Taylor
2021-12-08 19:33:45 +00:00
parent 8b73549355
commit 889d048ca3
26 changed files with 67 additions and 171 deletions

View File

@ -34,6 +34,7 @@ use pocketmine\scheduler\BulkCurlTaskOperation;
use pocketmine\timings\TimingsHandler;
use pocketmine\utils\InternetException;
use pocketmine\utils\InternetRequestResult;
use pocketmine\utils\Utils;
use Webmozart\PathUtil\Path;
use function count;
use function fclose;
@ -105,7 +106,7 @@ class TimingsCommand extends VanillaCommand{
}elseif($mode === "merged" or $mode === "report" or $paste){
$timings = "";
if($paste){
$fileTimings = fopen("php://temp", "r+b");
$fileTimings = Utils::assumeNotFalse(fopen("php://temp", "r+b"), "Opening php://temp should never fail");
}else{
$index = 0;
$timingFolder = Path::join($sender->getServer()->getDataPath(), "timings");