1 | <?php |
||
12 | class FavIconRule extends StandardRule |
||
13 | { |
||
14 | protected $contentTypes = array('image'); |
||
15 | |||
16 | private $favicons = array( |
||
17 | '231567a8cc45c2cf966c4e8d99a5b7fd' => 'symfony2', |
||
18 | '53a151ba1af3acdefe16fbbdad937ee4' => 'wordpress', |
||
19 | 'e6a9dc66179d8c9f34288b16a02f987e' => 'drupal', |
||
20 | '8718c2998236c796896b725f264092ee' => 'typo3', |
||
21 | '1da050bcdd95e30c3cd984cf1d450f81' => 'neos2', |
||
22 | 'abe604b0b1b232bc1d37ea23e619eb2a' => 'magento', |
||
23 | 'c1f20852dd1caf078f49de77a2de8e3f' => 'vbulletin', |
||
24 | 'cfe845e2eaaf1bf4e86b5921df1d39f3' => 'phpbb', |
||
25 | ); |
||
26 | |||
27 | protected function doValidation(ResponseInterface $response) |
||
37 | } |
||
38 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: