Closed colagrosso closed 3 months ago
There are a few functions like this one that I had to leave as returning ?string because of the file_exists() call. I considered returning an empty string in that case, but I decided not to.
?string
file_exists()
protected function GetHeroImage2xAvifUrl(): ?string{ if($this->_HeroImage2xAvifUrl === null){ if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-hero@2x.avif')){ $this->_HeroImage2xAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . $this->GetLatestCommitHash() . '-hero@2x.avif'; } } return $this->_HeroImage2xAvifUrl; }
Looks good, thanks!
There are a few functions like this one that I had to leave as returning
?string
because of thefile_exists()
call. I considered returning an empty string in that case, but I decided not to.