Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
21 | abstract class AbstractResolveEndpointActionTest extends BaseTestCase |
||
22 | { |
||
23 | /** @var ResolveEndpointBaseAction|\PHPUnit_Framework_MockObject_MockObject */ |
||
24 | protected $action; |
||
25 | |||
26 | /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ |
||
27 | protected $logger; |
||
28 | |||
29 | /** @var EndpointResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ |
||
30 | protected $endpointResolver; |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | */ |
||
35 | protected function setUp() : void |
||
41 | |||
42 | /** |
||
43 | * @param LoggerInterface $logger |
||
44 | * @param EndpointResolverInterface $endpointResolver |
||
45 | * |
||
46 | * @return ResolveEndpointBaseAction |
||
47 | */ |
||
48 | abstract protected function createAction(LoggerInterface $logger, EndpointResolverInterface $endpointResolver); |
||
49 | |||
50 | /** |
||
51 | * @param bool $shouldBeCalled |
||
52 | * @param callable $callback |
||
53 | */ |
||
54 | protected function setEndpointResolver($shouldBeCalled, $callback) |
||
65 | |||
66 | /** |
||
67 | * @param string $ownRole |
||
68 | * @param SamlMessage $inboundMessage |
||
69 | * @param Endpoint $endpoint |
||
70 | * @param EntityDescriptor $partyEntityDescriptor |
||
71 | * @param string $profileId |
||
72 | * |
||
73 | * @return \LightSaml\Context\Profile\ProfileContext |
||
74 | */ |
||
75 | protected function createContext( |
||
99 | |||
100 | /** |
||
101 | * @param CriteriaSet $criteriaSet |
||
102 | * @param array $bindings |
||
103 | */ |
||
104 | View Code Duplication | protected function criteriaSetShouldHaveBindingCriteria(CriteriaSet $criteriaSet, array $bindings) |
|
115 | |||
116 | /** |
||
117 | * @param CriteriaSet $criteriaSet |
||
118 | * @param string $value |
||
119 | */ |
||
120 | View Code Duplication | protected function criteriaSetShouldHaveDescriptorTypeCriteria(CriteriaSet $criteriaSet, $value) |
|
131 | |||
132 | /** |
||
133 | * @param CriteriaSet $criteriaSet |
||
134 | * @param string $value |
||
135 | */ |
||
136 | View Code Duplication | protected function criteriaSetShouldHaveServiceTypeCriteria(CriteriaSet $criteriaSet, $value) |
|
147 | |||
148 | /** |
||
149 | * @param CriteriaSet $criteriaSet |
||
150 | * @param string $value |
||
151 | */ |
||
152 | View Code Duplication | protected function criteriaSetShouldHaveIndexCriteria(CriteriaSet $criteriaSet, $value) |
|
163 | |||
164 | /** |
||
165 | * @param CriteriaSet $criteriaSet |
||
166 | * @param string $value |
||
167 | */ |
||
168 | View Code Duplication | protected function criteriaSetShouldHaveLocationCriteria(CriteriaSet $criteriaSet, $value) |
|
179 | } |
||
180 |
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..