Closed fujael closed 4 years ago
The PHP manual has this to say about keywords.
As of PHP 7.0.0 these keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name.
Taking that into consideration there is no problem with the code you reference.
Agreed. Perfectly acceptable code in the versions of PHP that we require.
The issue When one writes PHP code, he/she shouldn't use php core keywords. Take a look at those files-
codeigniter4\framework\system\View\Filters.php
(Line 114)public static function default
codeigniter4\framework\system\View\View.php
(Line 523)public function include
codeigniter4\framework\system\CLI\CLI.php
(Line 308)public static function print
codeigniter4\framework\system\RESTful\ResourcePresenter.php
(Line 107)public function new
codeigniter4\framework\system\RESTful\ResourcePresenter.php
(Line 104)public function new
CodeIgniter 4 version Release: 4.0.3
Describe the bug PHP has some reserved keywords like
new
default
include
class
,array
etc. If you use these reserved keywords it will make troubles to IDE parsers who has autocomplete features. So a developer avoids the conflicts at any cost.Affected module(s)
codeigniter4\framework\system\View\Filters.php
codeigniter4\framework\system\View\View.php
codeigniter4\framework\system\CLI\CLI.php
codeigniter4\framework\system\RESTful\ResourcePresenter.php
Expected behavior, and steps to reproduce if appropriate You can add underscore before function name like
public static function default
should bepublic static function _default
Context