refactor: enable AddFunctionVoidReturnTypeWhereNoReturnRector to add void to functions

This commit is contained in:
Abdul Malik Ikhsan 2024-06-30 14:39:29 +07:00
parent 1638990042
commit e792d438cf
No known key found for this signature in database
GPG Key ID: 69AC5BC354C89BE6
4 changed files with 7 additions and 11 deletions

View File

@ -58,6 +58,7 @@ use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
use Utils\Rector\RemoveErrorSuppressInTryCatchStmtsRector;
@ -219,6 +220,7 @@ return RectorConfig::configure()
VersionCompareFuncCallToConstantRector::class,
ExplicitBoolCompareRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
])
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
// keep '\\' prefix string on string '\Foo\Bar'

View File

@ -766,10 +766,8 @@ if (! function_exists('log_message')) {
* - notice
* - info
* - debug
*
* @return void
*/
function log_message(string $level, string $message, array $context = [])
function log_message(string $level, string $message, array $context = []): void
{
// When running tests, we want to always ensure that the
// TestLogger is running, which provides utilities for

View File

@ -35,7 +35,6 @@ if (! function_exists('set_cookie')) {
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
* @param string|null $sameSite The cookie SameSite value
*
* @return void
*
* @see \CodeIgniter\HTTP\Response::setCookie()
*/
@ -49,7 +48,7 @@ if (! function_exists('set_cookie')) {
?bool $secure = null,
?bool $httpOnly = null,
?string $sameSite = null
) {
): void {
$response = service('response');
$response->setCookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly, $sameSite);
}
@ -92,11 +91,10 @@ if (! function_exists('delete_cookie')) {
* @param string $path the cookie path
* @param string $prefix the cookie prefix
*
* @return void
*
* @see \CodeIgniter\HTTP\Response::deleteCookie()
*/
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = ''): void
{
service('response')->deleteCookie($name, $domain, $path, $prefix);
}

View File

@ -24,7 +24,7 @@ if (! function_exists('dd')) {
*
* @codeCoverageIgnore Can't be tested ... exits
*/
function dd(...$vars)
function dd(...$vars): void
{
// @codeCoverageIgnoreStart
Kint::$aliases[] = 'dd';
@ -71,10 +71,8 @@ if (! function_exists('trace')) {
*/
/**
* trace function
*
* @return void
*/
function trace()
function trace(): void
{
Kint::$aliases[] = 'trace';
Kint::trace();