Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace deprecated Services::request(config, false) #7998

Merged
merged 3 commits into from
Oct 10, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Oct 1, 2023

Description
Services::request() returns the current Request object.
The parameter $config and $getShared are deprecated.

/**
* Returns the current Request object.
*
* createRequest() injects IncomingRequest or CLIRequest.
*
* @return CLIRequest|IncomingRequest
*
* @deprecated The parameter $config and $getShared are deprecated.
*/
public static function request(?App $config = null, bool $getShared = true)
{
if ($getShared) {
return static::getSharedInstance('request', $config);
}
// @TODO remove the following code for backward compatibility
return AppServices::incomingrequest($config, $getShared);
}

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 refactor Pull requests that refactor code label Oct 1, 2023
kenjis added 2 commits October 3, 2023 15:16
…ommingrequest()

The parameter $config and $getShared are deprecated.
@kenjis kenjis force-pushed the refactor-service-request branch from a3cc90a to 262c048 Compare October 3, 2023 06:16
@kenjis kenjis force-pushed the refactor-service-request branch from 50e8eb3 to 93001f1 Compare October 3, 2023 06:41
@neznaika0
Copy link
Contributor

@kenjis
Copy link
Member Author

kenjis commented Oct 3, 2023

No. Services::request() returns the current Request object.
The parameter $config and $getShared are deprecated.
So if the code wants the current Request object and does not pass any parameters, it is okay.

In test code, there is no current Request object, so we need to prepare a correct request object for the test by ourselves.

@kenjis kenjis merged commit ff5185a into codeigniter4:develop Oct 10, 2023
60 checks passed
@kenjis kenjis deleted the refactor-service-request branch October 10, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants