Skip to content

Commit

Permalink
Merge pull request #9014 from samsonasik/refactor-void-function
Browse files Browse the repository at this point in the history
refactor: enable AddFunctionVoidReturnTypeWhereNoReturnRector to add void to functions
  • Loading branch information
samsonasik authored Jun 30, 2024
2 parents 1638990 + acefa3c commit 01f52ef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
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;
Expand Down Expand Up @@ -219,6 +220,7 @@
VersionCompareFuncCallToConstantRector::class,
ExplicitBoolCompareRector::class,
AddClosureVoidReturnTypeWhereNoReturnRector::class,
AddFunctionVoidReturnTypeWhereNoReturnRector::class,
])
->withConfiguredRule(StringClassNameToClassConstantRector::class, [
// keep '\\' prefix string on string '\Foo\Bar'
Expand Down
4 changes: 1 addition & 3 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,8 @@ function lang(string $line, array $args = [], ?string $locale = null)
* - 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
Expand Down
8 changes: 2 additions & 6 deletions system/Helpers/cookie_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
* @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()
*/
function set_cookie(
Expand All @@ -49,7 +47,7 @@ function 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);
}
Expand Down Expand Up @@ -92,11 +90,9 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
* @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);
}
Expand Down
6 changes: 2 additions & 4 deletions system/Helpers/kint_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @codeCoverageIgnore Can't be tested ... exits
*/
function dd(...$vars)
function dd(...$vars): void
{
// @codeCoverageIgnoreStart
Kint::$aliases[] = 'dd';
Expand Down Expand Up @@ -71,10 +71,8 @@ function d(...$vars)
*/
/**
* trace function
*
* @return void
*/
function trace()
function trace(): void
{
Kint::$aliases[] = 'trace';
Kint::trace();
Expand Down

0 comments on commit 01f52ef

Please sign in to comment.