| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 17 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 51 | protected function execute(InputInterface $input, OutputInterface $output)  | 
            ||
| 52 |     { | 
            ||
| 53 | parent::execute($input, $output);  | 
            ||
| 54 | $types = $this  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 55 | ->getSession()  | 
            ||
| 56 |             ->getPoolerForType('converter') | 
            ||
| 57 | ->getConverterHolder()  | 
            ||
| 58 | ->getTypes();  | 
            ||
| 59 |         $types = array_filter($types, function ($type) { | 
            ||
| 60 |             return !preg_match('/^pg_catalog\./', $type); | 
            ||
| 61 | });  | 
            ||
| 62 | natcasesort($types);  | 
            ||
| 63 | |||
| 64 |         foreach ($types as $type) { | 
            ||
| 65 | $output->writeln($type);  | 
            ||
| 66 | }  | 
            ||
| 67 | }  | 
            ||
| 68 | }  | 
            ||
| 69 | 
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: