Skip to content

Commit

Permalink
Fixed PHPStan level 8 errors for DependencyContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
nkl-kst committed Feb 5, 2024
1 parent 9657d61 commit 2998eec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Dependency/DependencyContainer.php
Expand Up @@ -11,6 +11,7 @@
use NklKst\TheSportsDb\Client\Endpoint\LookupEndpoint;
use NklKst\TheSportsDb\Client\Endpoint\ScheduleEndpoint;
use NklKst\TheSportsDb\Client\Endpoint\SearchEndpoint;
use NklKst\TheSportsDb\Exception\ClientInstantiationException;
use NklKst\TheSportsDb\Request\RequestBuilder;
use NklKst\TheSportsDb\Serializer\CountrySerializer;
use NklKst\TheSportsDb\Serializer\EquipmentSerializer;
Expand Down Expand Up @@ -72,7 +73,7 @@ class DependencyContainer
TimelineSerializer::class,
];

private static ?ContainerBuilder $builder = null;
private static ContainerBuilder $builder;

private static function load(): void
{
Expand Down Expand Up @@ -127,7 +128,7 @@ private static function compile(): void
self::$builder->compile();
}

public static function getClient(): ?Client
public static function getClient(): Client
{
// Load dependency container
self::load();
Expand All @@ -139,6 +140,6 @@ public static function getClient(): ?Client
}

// Something went wrong...
return null;
throw new ClientInstantiationException();
}
}
7 changes: 7 additions & 0 deletions src/Exception/ClientInstantiationException.php
@@ -0,0 +1,7 @@
<?php

namespace NklKst\TheSportsDb\Exception;

use RuntimeException;

class ClientInstantiationException extends RuntimeException {}

0 comments on commit 2998eec

Please sign in to comment.