dynamicConstantNames:
- DB_UPDATE_VERSION
+ # See all rules at https://github.com/phpstan/phpstan-strict-rules/blob/2.0.x/rules.neon
strictRules:
allRules: false
// Limit the number of displayed page number buttons.
if ($numpages > 8) {
- $numstart = (($this->getPage() > 4) ? ($this->getPage() - 4) : 1);
- $numstop = (($this->getPage() > ($numpages - 7)) ? $numpages : ($numstart + 8));
+ $numstart = ($this->getPage() > 4) ? ($this->getPage() - 4) : 1;
+ $numstop = ($this->getPage() > ($numpages - 7)) ? $numpages : ($numstart + 8);
}
$pages = [];
$xpath = new DOMXPath($doc);
- /** @var \DOMNode[] $list */
+ /** @var \DOMNodeList<\DOMNode>|false $list */
$list = $xpath->query("//" . $tag);
foreach ($list as $node) {
$attr = [];
*/
public static function checkRelMeLink(DOMDocument $doc, UriInterface $meUrl): bool
{
- $xpath = new \DOMXpath($doc);
+ $xpath = new \DOMXPath($doc);
// This expression checks that "me" is among the space-delimited values of the "rel" attribute.
// And that the href attribute contains exactly the provided URL
*/
protected function hasAcquiredLock(string $key): bool
{
- return isset($this->acquireLock[$key]) && $this->acquiredLocks[$key] === true;
+ return isset($this->acquiredLocks[$key]) && $this->acquiredLocks[$key] === true;
}
/**
}
#[\ReturnTypeWillChange]
- public function gc($max_lifetime): bool
+ /**
+ * @return int|false
+ */
+ public function gc($max_lifetime)
{
- return true;
+ return 0; // Cache does not support garbage collection, so we return 0 to indicate no action taken
}
}
}
#[\ReturnTypeWillChange]
- public function gc($max_lifetime): bool
+ /**
+ * @return int|false
+ */
+ public function gc($max_lifetime)
{
try {
- return $this->dba->delete('session', ["`expire` < ?", time()]);
+ $result = $this->dba->delete('session', ["`expire` < ?", time()]);
} catch (\Exception $exception) {
$this->logger->warning('Cannot use garbage collector.', ['exception' => $exception]);
return false;
}
+
+ if ($result !== false) {
+ // TODO: DBA::delete() returns true, but we need to return the number of deleted rows as interger
+ $result = 0;
+ }
+
+ return $result;
}
}
}
if ($sleeping) {
- DI::logger()->info('Cooldown ended.', ['max-load' => $load_cooldown, 'max-processes' => $processes_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]);
+ DI::logger()->info('Cooldown ended.', ['max-load' => $load_cooldown, 'max-processes' => $processes_cooldown, 'load' => $load ?? [], 'called-by' => System::callstack(1)]);
}
}
Contact::removeDuplicates($contact['nurl'], $contact['uid']);
}
- DBA::close($contact);
+ DBA::close($contacts);
DI::keyValue()->set('post_update_version', 1322);
DI::logger()->info('Done');
namespace Friendica\Network;
use DOMDocument;
-use DomXPath;
+use DOMXPath;
use Exception;
use Friendica\Content\Text\HTML;
use Friendica\Core\Hook;
return [];
}
- $xpath = new DomXPath($doc);
+ $xpath = new DOMXPath($doc);
$vcards = $xpath->query("//div[contains(concat(' ', @class, ' '), ' vcard ')]");
if (!is_object($vcards)) {
* Rotates image
*
* @param integer $degrees degrees to rotate image
- * @return mixed
*/
- public function rotate(int $degrees)
+ public function rotate(int $degrees): void
{
if (!$this->isValid()) {
- return false;
+ return;
}
if ($this->isImagick()) {
*
* @param boolean $horiz optional, default true
* @param boolean $vert optional, default false
- * @return mixed
*/
- public function flip(bool $horiz = true, bool $vert = false)
+ public function flip(bool $horiz = true, bool $vert = false): void
{
if (!$this->isValid()) {
- return false;
+ return;
}
if ($this->isImagick()) {
return [];
}
- $sig_block = self::parseSigHeader($http_headers['HTTP_SIGNATURE']);
+ $sig_block = self::parseSigheader($http_headers['HTTP_SIGNATURE']);
if (empty($sig_block['keyId'])) {
DI::logger()->debug('No keyId', ['sig_block' => $sig_block]);
}
}
- $sig_block = self::parseSigHeader($http_headers['HTTP_SIGNATURE']);
+ $sig_block = self::parseSigheader($http_headers['HTTP_SIGNATURE']);
// Add fields from the signature block to the header. See issue 8845
if (!empty($sig_block['created']) && empty($headers['(created)'])) {