Issues (15)

src/Logger/Logger.php (4 issues)

1
<?php
2
3
/**
4
 * This file is part of the Lazzard/ftp-bridge package.
5
 *
6
 * (c) El Amrani Chakir <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lazzard\FtpBridge\Logger;
13
14
/**
15
 * Basic FTP logger implementation that other FTP Loggers may extends its.
16
 *
17
 * @since  1.0
18
 * @author El Amrani Chakir <[email protected]>
19
 */
20
abstract class Logger implements LoggerInterface
21
{
22
    /** @var int */
23
    protected $mode;
24
25
    /**
26
     * @param string $mode
27
     */
28
    public function __construct($mode)
29
    {
30
        $this->mode = $mode;
0 ignored issues
show
Documentation Bug introduced by
The property $mode was declared of type integer, but $mode is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
31
    }
32
33
    /**
34
     * @inheritDoc
35
     */
36
    public function info($message)
37
    {
38
        $this->log(LogLevel::$info, $message);
0 ignored issues
show
Lazzard\FtpBridge\Logger\LogLevel::info of type string is incompatible with the type integer expected by parameter $level of Lazzard\FtpBridge\Logger\LoggerInterface::log(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
        $this->log(/** @scrutinizer ignore-type */ LogLevel::$info, $message);
Loading history...
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function error($message)
45
    {
46
        $this->log(LogLevel::$error, $message);
0 ignored issues
show
Lazzard\FtpBridge\Logger\LogLevel::error of type string is incompatible with the type integer expected by parameter $level of Lazzard\FtpBridge\Logger\LoggerInterface::log(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
        $this->log(/** @scrutinizer ignore-type */ LogLevel::$error, $message);
Loading history...
47
    }
48
49
    /**
50
     * @inheritDoc
51
     */
52
    public function command($message)
53
    {
54
        $this->log(LogLevel::$command, $message);
0 ignored issues
show
Lazzard\FtpBridge\Logger\LogLevel::command of type string is incompatible with the type integer expected by parameter $level of Lazzard\FtpBridge\Logger\LoggerInterface::log(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

54
        $this->log(/** @scrutinizer ignore-type */ LogLevel::$command, $message);
Loading history...
55
    }
56
}