Skip to content

Conversation

@kenjis
Copy link
Member

@kenjis kenjis commented Jun 29, 2022

Description

  • add missing CLIRequest::getLocale()
$ php spark make:controller Test

CodeIgniter v4.2.1 Command Line Tool - Server Time: 2022-06-28 21:48:32 UTC-05:00


[Error]

Call to undefined method CodeIgniter\HTTP\CLIRequest::getLocale()

at SYSTEMPATH/Config/Services.php:367

Backtrace:
  1    SYSTEMPATH/Config/BaseService.php:253
       CodeIgniter\Config\Services::language(null, false)

  2    SYSTEMPATH/Config/BaseService.php:194
       CodeIgniter\Config\BaseService::__callStatic('language', [...])

  3    SYSTEMPATH/Config/Services.php:363
       CodeIgniter\Config\BaseService::getSharedInstance('language', null)

  4    SYSTEMPATH/Config/BaseService.php:253
       CodeIgniter\Config\Services::language()

  5    SYSTEMPATH/Common.php:745
       CodeIgniter\Config\BaseService::__callStatic('language', [])

  6    SYSTEMPATH/CLI/GeneratorTrait.php:160
       lang('CLI.generator.fileCreate', [...])

  7    SYSTEMPATH/Commands/Generators/ControllerGenerator.php:88
       CodeIgniter\Commands\Generators\ControllerGenerator()->execute([...])

  8    SYSTEMPATH/CLI/Commands.php:63
       CodeIgniter\Commands\Generators\ControllerGenerator()->run([...])

  9    SYSTEMPATH/CLI/CommandRunner.php:65
       CodeIgniter\CLI\Commands()->run('make:controller', [...])

 10    SYSTEMPATH/CLI/CommandRunner.php:51
       CodeIgniter\CLI\CommandRunner()->index([...])

 11    SYSTEMPATH/CodeIgniter.php:887
       CodeIgniter\CLI\CommandRunner()->_remap('index', [...])

 12    SYSTEMPATH/CodeIgniter.php:466
       CodeIgniter\CodeIgniter()->runController(Object(CodeIgniter\CLI\CommandRunner))

 13    SYSTEMPATH/CodeIgniter.php:345
       CodeIgniter\CodeIgniter()->handleRequest(null, Object(Config\Cache), false)

 14    SYSTEMPATH/CLI/Console.php:48
       CodeIgniter\CodeIgniter()->run()

 15    ROOTPATH/spark:86
       CodeIgniter\CLI\Console()->run()

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 29, 2022
@kenjis kenjis force-pushed the fix-CLIRequest-getLocale branch from f95f744 to fba1ee5 Compare June 29, 2022 05:42
/**
* Gets the current locale.
*/
public function getLocale(): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to put this on Request (or RequestTrait) so any request has it? IncomingRequest can still use it's negotiable version as an extension.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IncommingRequest has locale, but I don't think CLIRequest should have locale.

Okay, I was wrong. This method should not be added.

@kenjis kenjis closed this Jun 30, 2022
@kenjis kenjis mentioned this pull request Jun 30, 2022
5 tasks
@kenjis kenjis deleted the fix-CLIRequest-getLocale branch October 9, 2022 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants