for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Seasx\SeasLogger;
use Co;
/**
* Class Context
* @package Seasx\SeasLogger
*/
class Context
{
* @param string $name
* @param $value
public static function set(string $name, $value): void
/** @var \ArrayObject $context */
$context = Co::getContext();
$context
Co::getContext()
Swoole\Coroutine::getContext()
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
class A { function getObject() { return null; } } $a = new A(); $object = $a->getObject();
The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$context[$name] = $value;
}
* @return mixed
public static function get(string $name)
return isset($context[$name]) ? $context[$name] : null;
* @return bool
public static function has(string $name): bool
return isset($context[$name]);
public static function delete(string $name): void
unset($context[$name]);
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.