Skip to content

Commit

Permalink
refactor: Fix phpstan nullCoalesce
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Jan 5, 2025
1 parent 33110c5 commit a6e76e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion system/HTTP/Files/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public function guessExtension(): string
*/
public function getClientExtension(): string
{
return pathinfo($this->originalName, PATHINFO_EXTENSION) ?? '';
return pathinfo($this->originalName, PATHINFO_EXTENSION);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Router implements RouterInterface
/**
* A RouteCollection instance.
*
* @var RouteCollectionInterface
* @var RouteCollection|RouteCollectionInterface
*/
protected $collection;

Expand Down Expand Up @@ -144,6 +144,7 @@ class Router implements RouterInterface
public function __construct(RouteCollectionInterface $routes, ?Request $request = null)
{
$config = config(App::class);

if (isset($config->permittedURIChars)) {
$this->permittedURIChars = $config->permittedURIChars;
}
Expand All @@ -154,7 +155,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request
$this->controller = $this->collection->getDefaultController();
$this->method = $this->collection->getDefaultMethod();

$this->collection->setHTTPVerb($request->getMethod() ?? $_SERVER['REQUEST_METHOD']);
$this->collection->setHTTPVerb($request->getMethod() === '' ? $_SERVER['REQUEST_METHOD'] : $request->getMethod());

$this->translateURIDashes = $this->collection->shouldTranslateURIDashes();

Expand Down
1 change: 0 additions & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ includes:
- missingType.property.neon
- missingType.return.neon
- notIdentical.alwaysTrue.neon
- nullCoalesce.expr.neon
- nullCoalesce.property.neon
- nullCoalesce.variable.neon
- offsetAccess.notFound.neon
Expand Down
13 changes: 0 additions & 13 deletions utils/phpstan-baseline/nullCoalesce.expr.neon

This file was deleted.

0 comments on commit a6e76e2

Please sign in to comment.