Test Failed
Branch 1.0.0 (84f469)
by Zaahid
05:36
created

MessageFactory::newInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
/**
3
 * This file is part of the ZBateson\MailMimeParser project.
4
 *
5
 * @license http://opensource.org/licenses/bsd-license.php BSD
6
 */
7
namespace ZBateson\MailMimeParser\Message;
8
9
use ZBateson\MailMimeParser\Message;
10
use ZBateson\MailMimeParser\Message\Part\MimePartFactory;
11
use ZBateson\MailMimeParser\Message\Part\PartBuilder;
12
13
/**
14
 * Responsible for creating Message instances.
15
 *
16
 * @author Zaahid Bateson
17
 */
18
class MessageFactory extends MimePartFactory
19
{
20
    /**
21
     * Constructs a new Message object and returns it
22
     * 
23
     * @param string $messageObjectId
24
     * @param PartBuilder $partBuilder
25
     * @return \ZBateson\MailMimeParser\Message\Part\MimePart
26
     */
27
    public function newInstance($messageObjectId, PartBuilder $partBuilder)
28
    {
29
        return new Message(
30
            $this->headerFactory,
31
            $this->partFilterFactory,
0 ignored issues
show
Documentation introduced by
$this->partFilterFactory is of type object<ZBateson\MailMime...r\Header\HeaderFactory>, but the function expects a object<ZBateson\MailMime...sage\PartFilterFactory>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
32
            $messageObjectId,
33
            $partBuilder,
34
            $this->partStreamFilterManagerFactory->newInstance()
35
        );
36
    }
37
}
38