Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
28 | public function testParseXmlWithAllValidValuesNotLocalized() |
||
29 | { |
||
30 | $xml = <<<XML |
||
31 | <email> |
||
32 | <from name="from_name">[email protected]</from> |
||
33 | <replyTo>[email protected]</replyTo> |
||
34 | <to name="to_name1">[email protected]</to> |
||
35 | <to name="to_name2">[email protected]</to> |
||
36 | <to>[email protected]</to> |
||
37 | <cc name="cc_name1">[email protected]</cc> |
||
38 | <cc name="cc_name2">[email protected]</cc> |
||
39 | <cc>[email protected]</cc> |
||
40 | <bcc name="bcc_name1">[email protected]</bcc> |
||
41 | <bcc name="bcc_name2">[email protected]</bcc> |
||
42 | <bcc>[email protected]</bcc> |
||
43 | <subject>_subject</subject> |
||
44 | <messageText>_text_message</messageText> |
||
45 | <messageHtml><![CDATA[<p>_html_message</p>]]></messageHtml> |
||
46 | </email> |
||
47 | XML; |
||
48 | $this->xsdValidator->validate($xml, 'pathtoxsd.xsd')->shouldBeCalled(); |
||
49 | |||
50 | $parsedMessage = $this->fixture->parseMailDefinition($xml); |
||
51 | |||
52 | // from |
||
53 | $this->assertEquals(['[email protected]' => 'from_name'], $parsedMessage->getFrom()); |
||
54 | // reply-to |
||
55 | $this->assertEquals('[email protected]', $parsedMessage->getReplyTo()); |
||
56 | // to |
||
57 | $this->assertEquals([ |
||
58 | '[email protected]' => 'to_name1', |
||
59 | '[email protected]' => 'to_name2', |
||
60 | '[email protected]', |
||
61 | ], $parsedMessage->getTo()); |
||
62 | // cc |
||
63 | $this->assertEquals([ |
||
64 | '[email protected]' => 'cc_name1', |
||
65 | '[email protected]' => 'cc_name2', |
||
66 | '[email protected]', |
||
67 | ], $parsedMessage->getCc()); |
||
68 | // bcc |
||
69 | $this->assertEquals([ |
||
70 | '[email protected]' => 'bcc_name1', |
||
71 | '[email protected]' => 'bcc_name2', |
||
72 | '[email protected]', |
||
73 | ], $parsedMessage->getBcc()); |
||
74 | |||
75 | $this->assertEquals('_subject', $parsedMessage->getSubject()); |
||
76 | $this->assertEquals('_text_message', $parsedMessage->getMessageText()); |
||
77 | $this->assertEquals('<p>_html_message</p>', $parsedMessage->getMessageHtml()); |
||
78 | } |
||
79 | |||
119 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..