Move to PHPStan level 4

This commit is contained in:
Yassine Guedidi
2025-04-05 17:34:00 +02:00
parent 31e1be4191
commit b4483023e6
22 changed files with 116 additions and 104 deletions

View File

@ -143,11 +143,8 @@ class ContentProxy
}
try {
// is it already a DateTime?
// (it's inside the try/catch in case of fail to be parse time string)
if (!$date instanceof \DateTime) {
$date = new \DateTime($date);
}
$date = new \DateTime($date);
$entry->setPublishedAt($date);
} catch (\Exception $e) {

View File

@ -98,10 +98,10 @@ class DownloadImages
* - re-saved it (for security reason)
* - return the new local path.
*
* @param int $entryId ID of the entry
* @param string $imagePath Path to the image to retrieve
* @param string $url Url from where the image were found
* @param string $relativePath Relative local path to saved the image
* @param int $entryId ID of the entry
* @param string|null $imagePath Path to the image to retrieve
* @param string $url Url from where the image were found
* @param string $relativePath Relative local path to saved the image
*
* @return string|false Relative url to access the image from the web
*/
@ -136,7 +136,7 @@ class DownloadImages
}
$ext = $this->getExtensionFromResponse($res, $imagePath);
if (false === $res) {
if (false === $ext) {
return false;
}

View File

@ -20,8 +20,8 @@ class Redirect
}
/**
* @param string $url URL to redirect
* @param bool $ignoreActionMarkAsRead Ignore configured action when mark as read
* @param string|null $url URL to redirect
* @param bool $ignoreActionMarkAsRead Ignore configured action when mark as read
*
* @return string
*/

View File

@ -129,7 +129,8 @@ class RuleBasedTagger
private function fixEntry(Entry $entry)
{
$clonedEntry = clone $entry;
$clonedEntry->setReadingTime($entry->getReadingTime() / $entry->getUser()->getConfig()->getReadingSpeed() * 200);
$newReadingTime = (int) ($entry->getReadingTime() / $entry->getUser()->getConfig()->getReadingSpeed() * 200);
$clonedEntry->setReadingTime($newReadingTime);
return $clonedEntry;
}