CodeIgniter Forums
Adding Interfaces.. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Adding Interfaces.. (/showthread.php?tid=65631)



Adding Interfaces.. - sv3tli0 - 07-04-2016

To make CI a little bit more stable I think that it will be good to be added a few Interfaces. 
The most important reason for me to suggest this are Controllers. 

Currently you are able to match routers directly to Models Libs or etc.. 
If interface is added and verified when CI matches those routers at least some validation will be made and some BAD mistakes (specially from the young devs) won't exist. 

Currently: 
PHP Code:
$routes->add('/''App\\Models\\Test::index'); 

Is working pretty fine. If you have the test model and its index method. 

In such case an Interface exception should be thrown ( The matched class doesn't implement CodeIgniter Controllers interface.. )