Skip to content

Commit

Permalink
Merge pull request #7723 from kenjis/refactor-add-return-types-4.4
Browse files Browse the repository at this point in the history
refactor: [4.4] add types for phpstan
  • Loading branch information
kenjis authored Jul 22, 2023
2 parents dec4b71 + 05fc454 commit df5973b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Config/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Routing extends BaseRouting
* Example:
* public $override404 = 'App\Errors::show404';
*/
public $override404;
public ?string $override404 = null;

/**
* If TRUE, the system will attempt to match the URI against
Expand Down
2 changes: 1 addition & 1 deletion system/Config/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Routing extends BaseConfig
* Example:
* public $override404 = 'App\Errors::show404';
*/
public $override404;
public ?string $override404 = null;

/**
* If TRUE, the system will attempt to match the URI against
Expand Down
2 changes: 1 addition & 1 deletion system/Debug/BaseExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function collectVars(Throwable $exception, int $statusCode): array
*
* @param array|object $trace
*/
protected function maskSensitiveData(&$trace, array $keysToMask, string $path = '')
protected function maskSensitiveData(&$trace, array $keysToMask, string $path = ''): void
{
foreach ($keysToMask as $keyToMask) {
$explode = explode('/', $keyToMask);
Expand Down
3 changes: 3 additions & 0 deletions system/Exceptions/FrameworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public static function forInvalidFile(string $path)
return new static(lang('Core.invalidFile', [$path]));
}

/**
* @return static
*/
public static function forInvalidDirectory(string $path)
{
return new static(lang('Core.invalidDirectory', [$path]));
Expand Down
2 changes: 1 addition & 1 deletion system/HTTP/SiteURI.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function refreshPath()
/**
* Saves our parts from a parse_url() call.
*/
protected function applyParts(array $parts)
protected function applyParts(array $parts): void
{
if (! empty($parts['host'])) {
$this->host = $parts['host'];
Expand Down
2 changes: 1 addition & 1 deletion system/HotReloader/HotReloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class HotReloader
{
public function run()
public function run(): void
{
ini_set('zlib.output_compression', 'Off');

Expand Down
2 changes: 1 addition & 1 deletion system/Router/AutoRouterImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __construct(// @phpstan-ignore-line
$this->controller = $this->defaultController;
}

private function createSegments(string $uri)
private function createSegments(string $uri): array
{
$segments = explode('/', $uri);
$segments = array_filter($segments, static fn ($segment) => $segment !== '');
Expand Down

0 comments on commit df5973b

Please sign in to comment.