Skip to content

Commit e792d43

Browse files
committed
refactor: enable AddFunctionVoidReturnTypeWhereNoReturnRector to add void to functions
1 parent 1638990 commit e792d43

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

rector.php

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +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
3938
*
4039
* @see \CodeIgniter\HTTP\Response::setCookie()
4140
*/
@@ -49,7 +48,7 @@ function set_cookie(
4948
?bool $secure = null,
5049
?bool $httpOnly = null,
5150
?string $sameSite = null
52-
) {
51+
): void {
5352
$response = service('response');
5453
$response->setCookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly, $sameSite);
5554
}
@@ -92,11 +91,10 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
9291
* @param string $path the cookie path
9392
* @param string $prefix the cookie prefix
9493
*
95-
* @return void
9694
*
9795
* @see \CodeIgniter\HTTP\Response::deleteCookie()
9896
*/
99-
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = '')
97+
function delete_cookie($name, string $domain = '', string $path = '/', string $prefix = ''): void
10098
{
10199
service('response')->deleteCookie($name, $domain, $path, $prefix);
102100
}

system/Helpers/kint_helper.php

Lines changed: 2 additions & 4 deletions
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)