| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| 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 |
||
| 69 | public function matchProvider() |
||
| 70 | { |
||
| 71 | return [ |
||
| 72 | [SimplifiedRequest::fromUrl('http://example.com'), 'fifth_sa'], |
||
| 73 | [SimplifiedRequest::fromUrl('https://example.com'), 'fourth_sa'], |
||
| 74 | [SimplifiedRequest::fromUrl('http://example.com/'), 'fifth_sa'], |
||
| 75 | [SimplifiedRequest::fromUrl('https://example.com/'), 'fourth_sa'], |
||
| 76 | [SimplifiedRequest::fromUrl('http://example.com//'), 'fifth_sa'], |
||
| 77 | [SimplifiedRequest::fromUrl('https://example.com//'), 'fourth_sa'], |
||
| 78 | [SimplifiedRequest::fromUrl('http://example.com:8080/'), 'default_sa'], |
||
| 79 | [SimplifiedRequest::fromUrl('http://example.com/first_siteaccess/'), 'fifth_sa'], |
||
| 80 | [SimplifiedRequest::fromUrl('http://example.com/?first_siteaccess'), 'fifth_sa'], |
||
| 81 | [SimplifiedRequest::fromUrl('http://example.com/?first_sa'), 'fifth_sa'], |
||
| 82 | [SimplifiedRequest::fromUrl('http://example.com/first_salt'), 'fifth_sa'], |
||
| 83 | [SimplifiedRequest::fromUrl('http://example.com/first_sa.foo'), 'fifth_sa'], |
||
| 84 | [SimplifiedRequest::fromUrl('http://example.com/test'), 'fifth_sa'], |
||
| 85 | [SimplifiedRequest::fromUrl('http://example.com/test/foo/'), 'fifth_sa'], |
||
| 86 | [SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/'), 'fifth_sa'], |
||
| 87 | [SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/first_sa'), 'fifth_sa'], |
||
| 88 | [SimplifiedRequest::fromUrl('http://example.com/default_sa'), 'fifth_sa'], |
||
| 89 | |||
| 90 | [SimplifiedRequest::fromUrl('http://example.com/first_sa'), 'first_sa'], |
||
| 91 | [SimplifiedRequest::fromUrl('http://example.com/first_sa/'), 'first_sa'], |
||
| 92 | // Shouldn't match "first_sa" because of double slash |
||
| 93 | [SimplifiedRequest::fromUrl('http://example.com//first_sa/'), 'fifth_sa'], |
||
| 94 | [SimplifiedRequest::fromUrl('http://example.com/first_sa//'), 'first_sa'], |
||
| 95 | [SimplifiedRequest::fromUrl('http://example.com/first_sa///test'), 'first_sa'], |
||
| 96 | [SimplifiedRequest::fromUrl('http://example.com/first_sa/foo'), 'first_sa'], |
||
| 97 | [SimplifiedRequest::fromUrl('http://example.com/first_sa/foo/bar'), 'first_sa'], |
||
| 98 | [SimplifiedRequest::fromUrl('http://example.com:82/first_sa/'), 'first_sa'], |
||
| 99 | [SimplifiedRequest::fromUrl('http://third_siteaccess/first_sa/'), 'first_sa'], |
||
| 100 | [SimplifiedRequest::fromUrl('http://first_sa/'), 'first_sa'], |
||
| 101 | [SimplifiedRequest::fromUrl('https://first_sa/'), 'first_sa'], |
||
| 102 | [SimplifiedRequest::fromUrl('http://first_sa:81/'), 'first_sa'], |
||
| 103 | [SimplifiedRequest::fromUrl('http://first_siteaccess/'), 'first_sa'], |
||
| 104 | [SimplifiedRequest::fromUrl('http://first_siteaccess:82/'), 'first_sa'], |
||
| 105 | [SimplifiedRequest::fromUrl('http://first_siteaccess:83/'), 'first_sa'], |
||
| 106 | [SimplifiedRequest::fromUrl('http://first_siteaccess/foo/'), 'first_sa'], |
||
| 107 | [SimplifiedRequest::fromUrl('http://first_siteaccess:82/foo/'), 'first_sa'], |
||
| 108 | [SimplifiedRequest::fromUrl('http://first_siteaccess:83/foo/'), 'first_sa'], |
||
| 109 | |||
| 110 | [SimplifiedRequest::fromUrl('http://example.com/second_sa'), 'second_sa'], |
||
| 111 | [SimplifiedRequest::fromUrl('http://example.com/second_sa/'), 'second_sa'], |
||
| 112 | [SimplifiedRequest::fromUrl('http://example.com/second_sa?param1=foo'), 'second_sa'], |
||
| 113 | [SimplifiedRequest::fromUrl('http://example.com/second_sa/foo/'), 'second_sa'], |
||
| 114 | [SimplifiedRequest::fromUrl('http://example.com:82/second_sa/'), 'second_sa'], |
||
| 115 | [SimplifiedRequest::fromUrl('http://example.com:83/second_sa/'), 'second_sa'], |
||
| 116 | [SimplifiedRequest::fromUrl('http://first_siteaccess:82/second_sa/'), 'second_sa'], |
||
| 117 | [SimplifiedRequest::fromUrl('http://first_siteaccess:83/second_sa/'), 'second_sa'], |
||
| 118 | |||
| 119 | [SimplifiedRequest::fromUrl('http://example.com:81/'), 'third_sa'], |
||
| 120 | [SimplifiedRequest::fromUrl('https://example.com:81/'), 'third_sa'], |
||
| 121 | [SimplifiedRequest::fromUrl('http://example.com:81/foo'), 'third_sa'], |
||
| 122 | [SimplifiedRequest::fromUrl('http://example.com:81/foo/bar'), 'third_sa'], |
||
| 123 | |||
| 124 | [SimplifiedRequest::fromUrl('http://example.com:82/'), 'fourth_sa'], |
||
| 125 | [SimplifiedRequest::fromUrl('https://example.com:82/'), 'fourth_sa'], |
||
| 126 | [SimplifiedRequest::fromUrl('https://example.com:82/foo'), 'fourth_sa'], |
||
| 127 | ]; |
||
| 128 | } |
||
| 129 | |||
| 165 |
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..