for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Ekino New Relic bundle.
*
* (c) Ekino - Thomas Rabaix <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Ekino\Bundle\NewRelicBundle\Logging;
use Monolog\Handler\NewRelicHandler;
use Psr\Log\LogLevel;
class AutoHandler extends NewRelicHandler
{
public function __construct(
$level = LogLevel::ERROR,
$bubble = true,
$appName = null,
$explodeArrays = false,
$transactionName = null
) {
parent::__construct($level, $bubble, $appName, $explodeArrays, $transactionName);
}
/**
* {@inheritdoc}
protected function write(array $record)
if (!$this->isNewRelicEnabled()) {
return;
return parent::write($record);
parent::write($record)
Monolog\Handler\NewRelicHandler::write()
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.
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.