It is generally recommended to explicitly declare the visibility for methods.
Adding explicit visibility (private, protected, or public) is generally
recommend to communicate to other developers how, and from where this method
is intended to be used.
Loading history...
13
{
14
$this->debug = !!$debug;
15
}
16
17
/**
18
* Logs with an arbitrary level.
19
*
20
* @param mixed $level
21
* @param string $message
22
* @param array $context
23
* @return null
24
*/
25
public function log($level, $message, array $context = array())
The expression $context of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an
empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using empty(..) or !empty(...) instead.
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.