Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions packages/container/src/GenericContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function config(object $config): self
* @param class-string<TClassName> $className
* @return null|TClassName
*/
public function get(string $className, null|string|UnitEnum $tag = null, mixed ...$params): ?object
public function get(string $className, null|string|UnitEnum $tag = null, mixed ...$params): object
{
$this->resolveChain();

Expand Down Expand Up @@ -325,7 +325,7 @@ public function addDecorator(ClassReflector|string $decoratorClass, ClassReflect
return $this;
}

private function resolve(string $className, null|string|UnitEnum $tag = null, mixed ...$params): ?object
private function resolve(string $className, null|string|UnitEnum $tag = null, mixed ...$params): object
{
$instance = $this->resolveDependency($className, $tag, ...$params);

Expand All @@ -336,7 +336,7 @@ private function resolve(string $className, null|string|UnitEnum $tag = null, mi
return $instance;
}

private function resolveDependency(string $className, null|string|UnitEnum $tag = null, mixed ...$params): ?object
private function resolveDependency(string $className, null|string|UnitEnum $tag = null, mixed ...$params): object
{
$class = new ClassReflector($className);

Expand Down Expand Up @@ -646,7 +646,7 @@ private function resolveTaggedName(string $className, null|string|UnitEnum $tag)
: $className;
}

private function resolveDecorator(string $className, mixed $instance, null|string|UnitEnum $tag = null, mixed ...$params): ?object
private function resolveDecorator(string $className, mixed $instance, null|string|UnitEnum $tag = null, mixed ...$params): object
{
foreach ($this->decorators[$className] ?? [] as $decoratorClass) {
$decoratorClassReflector = new ClassReflector($decoratorClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Tests\Tempest\Integration\Database\QueryStatements;

use PHPUnit\Framework\Attributes\Test;
use RuntimeException;

Check warning on line 8 in tests/Integration/Database/QueryStatements/AlterTableStatementTest.php

View workflow job for this annotation

GitHub Actions / Run style check

no-redundant-use

Unused import: `RuntimeException`. Help: Remove the entire `use` statement.
use Tempest\Database\Config\DatabaseConfig;
use Tempest\Database\Config\DatabaseDialect;
use Tempest\Database\Exceptions\QueryWasInvalid;
Expand Down Expand Up @@ -45,11 +45,10 @@
email: '[email protected]',
);
} catch (QueryWasInvalid $queryWasInvalid) {
$message = match ($this->container->get(DatabaseConfig::class)?->dialect) {
$message = match ($this->container->get(DatabaseConfig::class)->dialect) {
DatabaseDialect::MYSQL => "Unknown column 'email'",
DatabaseDialect::SQLITE => 'table users has no column named email',
DatabaseDialect::POSTGRESQL => 'column "email" of relation "users" does not exist',
null => throw new RuntimeException('No database dialect available'),
};

$this->assertStringContainsString($message, $queryWasInvalid->getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Tests\Tempest\Integration\Database\QueryStatements;

use RuntimeException;

Check warning on line 7 in tests/Integration/Database/QueryStatements/CreateTableStatementTest.php

View workflow job for this annotation

GitHub Actions / Run style check

no-redundant-use

Unused import: `RuntimeException`. Help: Remove the entire `use` statement.
use Tempest\Database\Config\DatabaseConfig;
use Tempest\Database\Config\DatabaseDialect;
use Tempest\Database\Database;
Expand Down Expand Up @@ -67,12 +67,12 @@
}
};

$dialect = $this->container->get(DatabaseConfig::class)?->dialect;
$dialect = $this->container->get(DatabaseConfig::class)->dialect;

match ($dialect) {
DatabaseDialect::MYSQL => $this->expectNotToPerformAssertions(),
DatabaseDialect::SQLITE => $this->expectException(DialectWasNotSupported::class),
DatabaseDialect::POSTGRESQL => $this->expectException(DialectWasNotSupported::class),
null => throw new RuntimeException('No database dialect available'),
};

$this->migrate(
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/View/Components/IconComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function test_it_caches_icons_on_the_first_render(): void
$this->render('<x-icon name="ph:eye" />');

$iconCache = $this->container->get(IconCache::class);
$cachedIcon = $iconCache?->get('icon-ph-eye');
$cachedIcon = $iconCache->get('icon-ph-eye');

$this->assertNotNull($cachedIcon);
$this->assertSame('<svg></svg>', $cachedIcon);
Expand Down
Loading