Skip to content

Commit 01f52ef

Browse files
authored
Merge pull request #9014 from samsonasik/refactor-void-function
refactor: enable AddFunctionVoidReturnTypeWhereNoReturnRector to add void to functions
2 parents 1638990 + acefa3c commit 01f52ef

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

rector.php

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
5959
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
6060
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
61+
use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector;
6162
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
6263
use Utils\Rector\PassStrictParameterToFunctionParameterRector;
6364
use Utils\Rector\RemoveErrorSuppressInTryCatchStmtsRector;
@@ -219,6 +220,7 @@
219220
VersionCompareFuncCallToConstantRector::class,
220221
ExplicitBoolCompareRector::class,
221222
AddClosureVoidReturnTypeWhereNoReturnRector::class,
223+
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
222224
])
223225
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
224226
// keep '\\' prefix string on string '\Foo\Bar'

system/Common.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,8 @@ function lang(string $line, array $args = [], ?string $locale = null)
766766
* - notice
767767
* - info
768768
* - debug
769-
*
770-
* @return void
771769
*/
772-
function log_message(string $level, string $message, array $context = [])
770+
function log_message(string $level, string $message, array $context = []): void
773771
{
774772
// When running tests, we want to always ensure that the
775773
// TestLogger is running, which provides utilities for

system/Helpers/cookie_helper.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
3636
* @param string|null $sameSite The cookie SameSite value
3737
*
38-
* @return void
39-
*
4038
* @see \CodeIgniter\HTTP\Response::setCookie()
4139
*/
4240
function set_cookie(
@@ -49,7 +47,7 @@ function set_cookie(
4947
?bool $secure = null,
5048
?bool $httpOnly = null,
5149
?string $sameSite = null
52-
) {
50+
): void {
5351
$response = service('response');
5452
$response->setCookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly, $sameSite);
5553
}
@@ -92,11 +90,9 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
9290
* @param string $path the cookie path
9391
* @param string $prefix the cookie prefix
9492
*
95-
* @return void
96-
*
9793
* @see \CodeIgniter\HTTP\Response::deleteCookie()
9894
*/
99-
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')
95+
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = ''): void
10096
{
10197
service('response')->deleteCookie($name, $domain, $path, $prefix);
10298
}

system/Helpers/kint_helper.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* @codeCoverageIgnore Can't be tested ... exits
2626
*/
27-
function dd(...$vars)
27+
function dd(...$vars): void
2828
{
2929
// @codeCoverageIgnoreStart
3030
Kint::$aliases[] = 'dd';
@@ -71,10 +71,8 @@ function d(...$vars)
7171
*/
7272
/**
7373
* trace function
74-
*
75-
* @return void
7674
*/
77-
function trace()
75+
function trace(): void
7876
{
7977
Kint::$aliases[] = 'trace';
8078
Kint::trace();

0 commit comments

Comments
 (0)