| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php defined('BASEPATH') OR exit('No direct script access allowed'); |
||
| 9 | public function up() { |
||
| 10 | $fields = array( |
||
| 11 | 'mal_id' => array( |
||
| 12 | 'type' => 'MEDIUMINT', |
||
| 13 | 'constraint' => '7', |
||
| 14 | 'null' => TRUE, |
||
| 15 | 'unsigned' => TRUE, |
||
| 16 | |||
| 17 | //'default' => NULL |
||
| 18 | ) |
||
| 19 | ); |
||
| 20 | |||
| 21 | $this->dbforge->add_column('tracker_titles', $fields, 'status'); |
||
| 22 | $this->dbforge->add_column('tracker_chapters', $fields, 'ignore_chapter'); |
||
| 23 | } |
||
| 24 | |||
| 31 |
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 sub-classes 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 parent class: