Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [4.4] add types for phpstan #7723

Merged
merged 3 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading