Why spark adding ResponseInterface to controller? |
Why spark adding ResponseInterface to controller as it is not directly used in the scope?
php spark make:controller Test PHP Code: <?php
Run
Code: php spark make:controller --restful
Thank you, I appreciate it. But it is not an answer on my question. What is the reason behind adding it by default?
It just means that the output is not optimized for each controller.
Normal controllers do not need ResponseInterace, but a dev may use it. Besides, unused use statements are automatically removed by php-cs-fixer, so devs don't need to worry about them.
@Muzikant You don't have to be a fan of other developers and other developers who are interested in using ResponseInterface also won't use likewise
so bear in mind that the framework lesson basement should have basic tools to help facilitate some tasks to a developer so that you don't need to worry otherwise you may remove either by manual or php-cs-fixer as @kenjis says Codeigniter First, Codeigniter Then You!!
yekrinaDigitals
"use CodeIgniter\HTTP\ResponseInterface" was added because REST controller uses it.
Also, the return types of controller action methods are only string or ResponseInterface.
CodeIgniter DevKit provides useful tools for development.
https://github.com/codeigniter4/devkit
(02-21-2024, 06:30 PM)kenjis Wrote: CodeIgniter DevKit provides useful tools for development. I'm new here, and this will be useful for me, I'm grateful to you for sharing this. |
Welcome Guest, Not a member yet? Register Sign In |