for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Service;
use Monolog\Logger;
final class LoggerService
{
private Logger $logger;
public function __construct(Logger $logger)
$this->logger = $logger;
}
public function setDebug(string $msg)
return $this->logger->debug($msg . ' (LEVEL-100)');
$this->logger->debug($msg . ' (LEVEL-100)')
Monolog\Logger::debug()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
public function setInfo(string $msg)
return $this->logger->info($msg . ' (LEVEL-200)');
$this->logger->info($msg . ' (LEVEL-200)')
Monolog\Logger::info()
public function setWarning(string $msg)
return $this->logger->warning($msg . ' (LEVEL-300)');
$this->logger->warning($msg . ' (LEVEL-300)')
Monolog\Logger::warning()
public function setError(string $msg)
return $this->logger->error($msg . ' (LEVEL-400)');
$this->logger->error($msg . ' (LEVEL-400)')
Monolog\Logger::error()
public function setCritical(string $msg)
return $this->logger->critical($msg . ' (LEVEL-500)');
$this->logger->critical($msg . ' (LEVEL-500)')
Monolog\Logger::critical()
public function setAlert(string $msg)
return $this->logger->alert($msg . ' (LEVEL-550)');
$this->logger->alert($msg . ' (LEVEL-550)')
Monolog\Logger::alert()
public function setEmergency(string $msg)
return $this->logger->emergency($msg . ' (LEVEL-600)');
$this->logger->emergency($msg . ' (LEVEL-600)')
Monolog\Logger::emergency()
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.