src/Yabot.php
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
LoggerInterface $logger,
LoopInterface $eventLoop,
Client $slackClient,
MessageFactory $messageFactory,
PluginManager $pluginManager,
Avoid assigning values to variables in if clauses and the like (line '220', column '13'). Open
Open
protected function startConnectionMonitor()
{
if ($interval = $this->get('connection_monitor.interval')) {
$this->getLog()->info("Monitoring websocket connection every $interval seconds.");
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '269', column '13'). Open
Open
protected function notify(string $message)
{
if ($user = $this->get('notify.user')) {
$this->getSlack()->directMessage($message, $user);
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid unused parameters such as '$payload'. Open
Open
public function onTeamJoin(Payload $payload)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Property \Nopolabs\Yabot\Yabot->monitor
has undeclared type \React\EventLoop\Timer\TimerInterface
Open
Open
private $monitor;
- Exclude checks
Possibly zero references to use statement for classlike/namespace PluginInterface
(\Nopolabs\Yabot\Plugin\PluginInterface)
Open
Open
use Nopolabs\Yabot\Plugin\PluginInterface;
- Exclude checks
Parameter $eventLoop
has undeclared type \React\EventLoop\LoopInterface
Open
Open
public function __construct(
- Exclude checks
Parameter $logger
has undeclared type \Psr\Log\LoggerInterface
Open
Open
public function __construct(
- Exclude checks
Assigning null
to property but \Nopolabs\Yabot\Yabot->messageLog
is string
Open
Open
$this->messageLog = null;
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('Reconnecting...');
- Exclude checks
Call to method cancelTimer
from undeclared class \React\EventLoop\LoopInterface
Open
Open
$this->loop->cancelTimer($this->monitor);
- Exclude checks
Call to method then
from undeclared class \React\Promise\PromiseInterface
Open
Open
$this->getSlack()->reconnect()->then(
- Exclude checks
Parameter $payload
has undeclared type \Slack\Payload
Open
Open
public function onTeamJoin(Payload $payload)
- Exclude checks
Assigning ?string|null
to property but \Nopolabs\Yabot\Yabot->messageLog
is string
Open
Open
$this->messageLog = $messageLog ?? null;
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('Connection failed, shutting down.');
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('No pong.');
- Exclude checks
Call to method getMessage
from undeclared class \React\Promise\Timer\timeoutexception
Open
Open
$this->getLog()->error($error->getMessage());
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('Connection failed, shutting down.');
- Exclude checks
Call to method getData
from undeclared class \Slack\Payload
Open
Open
$data = $payload->getData();
- Exclude checks
Call to method info
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->info("Monitoring websocket connection every $interval seconds.");
- Exclude checks
Call to method then
from undeclared class \React\Promise\PromiseInterface
Open
Open
$this->getSlack()->ping()
- Exclude checks
Call to method stop
from undeclared class \React\EventLoop\LoopInterface
Open
Open
$this->getLoop()->stop();
- Exclude checks
Call to method addPeriodicTimer
from undeclared class \React\EventLoop\LoopInterface
Open
Open
return $this->loop->addPeriodicTimer($interval, function () {
- Exclude checks
Parameter $payload
has undeclared type \Slack\Payload
Open
Open
function (Payload $payload) {
- Exclude checks
Call to undeclared function \React\Promise\Timer\timeout()
Open
Open
Timer\timeout($this->getSlack()->connect(), 30, $this->getLoop())
- Exclude checks
Call to method info
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->info('Connecting...');
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('Shutting down...');
- Exclude checks
Return type of startConnectionMonitor()
is undeclared type \React\EventLoop\Timer\TimerInterface
Open
Open
protected function startConnectionMonitor()
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error($error->getMessage());
- Exclude checks
Call to method info
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->info('Reconnected');
- Exclude checks
Call to method info
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->info('Connected.');
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error('Reconnect failed, shutting down.');
- Exclude checks
Parameter $error
has undeclared type \React\Promise\Timer\timeoutexception
Open
Open
->otherwise(function (Timer\TimeoutException $error) {
- Exclude checks
Parameter $authedUser
has undeclared type \Slack\User
Open
Open
$slack->update(function(User $authedUser) {
- Exclude checks
Argument 1 (hour)
is string
but \DateTime::setTime()
takes int
Open
Open
$then->setTime($then->format('H'), 0, 0);
- Exclude checks
Call to method error
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->error("Unknown connection_monitor.failure_strategy '$failureStrategy'");
- Exclude checks
Call to method run
from undeclared class \React\EventLoop\LoopInterface
Open
Open
$this->getLoop()->run();
- Exclude checks
Call to method toJson
from undeclared class \Slack\Payload
Open
Open
$this->getLog()->info($payload->toJson());
- Exclude checks
Parameter $payload
has undeclared type \Slack\Payload
Open
Open
public function onMessage(Payload $payload)
- Exclude checks
Call to method info
from undeclared class \Psr\Log\LoggerInterface
Open
Open
$this->getLog()->info($payload->toJson());
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$slack->update(function(User $authedUser) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$this->addTimer($delay, function() {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$this->addPeriodicTimer(3600, function() {
- Exclude checks
Blank line found at start of control structure Open
Open
if ($interval = $this->get('connection_monitor.interval')) {
- Exclude checks