Skip to content

Commit 37ff3a4

Browse files
authored
Merge pull request #7917 from paulbalandan/phpstan-helpers
fix: types for common functions
2 parents 10b2514 + 7d3db2c commit 37ff3a4

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

phpstan-baseline.php

-15
Original file line numberDiff line numberDiff line change
@@ -521,21 +521,6 @@
521521
'count' => 8,
522522
'path' => __DIR__ . '/system/Common.php',
523523
];
524-
$ignoreErrors[] = [
525-
'message' => '#^Function force_https\\(\\) has no return type specified\\.$#',
526-
'count' => 1,
527-
'path' => __DIR__ . '/system/Common.php',
528-
];
529-
$ignoreErrors[] = [
530-
'message' => '#^Function helper\\(\\) has no return type specified\\.$#',
531-
'count' => 1,
532-
'path' => __DIR__ . '/system/Common.php',
533-
];
534-
$ignoreErrors[] = [
535-
'message' => '#^Function timer\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
536-
'count' => 1,
537-
'path' => __DIR__ . '/system/Common.php',
538-
];
539524
$ignoreErrors[] = [
540525
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
541526
'count' => 2,

system/Common.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ function force_https(
481481
int $duration = 31_536_000,
482482
?RequestInterface $request = null,
483483
?ResponseInterface $response = null
484-
) {
484+
): void {
485485
$request ??= Services::request();
486486

487487
if (! $request instanceof IncomingRequest) {
@@ -590,7 +590,7 @@ function function_usable(string $functionName): bool
590590
*
591591
* @throws FileNotFoundException
592592
*/
593-
function helper($filenames)
593+
function helper($filenames): void
594594
{
595595
static $loaded = [];
596596

@@ -1139,6 +1139,8 @@ function stringify_attributes($attributes, bool $js = false): string
11391139
* returns its return value if any.
11401140
* Otherwise will start or stop the timer intelligently.
11411141
*
1142+
* @phpstan-param (callable(): mixed)|null $callable
1143+
*
11421144
* @return Timer
11431145
*/
11441146
function timer(?string $name = null, ?callable $callable = null)

0 commit comments

Comments
 (0)