Skip to content

Commit 990ee07

Browse files
authored
Apply suggestions from code review
1 parent 57c4ab7 commit 990ee07

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Traits/GetDependenciesTrait.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ protected function transformDependency(ReflectionParameter $parameter): ?string
3131

3232
protected function getClassByInterface($interfaceName): ?string
3333
{
34-
$bindings = Container::getInstance()->getBindings();
34+
$app = Container::getInstance();
35+
36+
$bindings = $app->getBindings();
3537

3638
$implementation = Arr::get($bindings, "{$interfaceName}.concrete");
3739

3840
if (empty($implementation)) {
3941
return null;
4042
}
4143

42-
return get_class(call_user_func($implementation, app()));
44+
return get_class(call_user_func($implementation, $app));
4345
}
4446
}

tests/SwaggerServiceTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
use RonasIT\AutoDoc\Exceptions\UnsupportedDocumentationViewerException;
1212
use RonasIT\AutoDoc\Exceptions\WrongSecurityConfigException;
1313
use RonasIT\AutoDoc\Services\SwaggerService;
14-
use RonasIT\AutoDoc\Tests\Support\Mock\InvokableTestController;
1514
use RonasIT\AutoDoc\Tests\Support\Mock\TestContract;
1615
use RonasIT\AutoDoc\Tests\Support\Mock\TestNotificationSetting;
1716
use RonasIT\AutoDoc\Tests\Support\Mock\TestRequest;
18-
use RonasIT\AutoDoc\Tests\Support\Mock\TestRequestContract;
1917
use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceMockTrait;
2018
use stdClass;
2119

@@ -684,22 +682,22 @@ public function testAddDataWithNotExistsMethodOnController()
684682
$service->addData($request, $response);
685683
}
686684

687-
public static function addDataWithBindingInterface(): array
685+
public static function getImplementations(): array
688686
{
689687
return [
690688
[
691-
'concrete' => TestRequest::class,
689+
'implementation' => TestRequest::class,
692690
],
693691
[
694-
'concrete' => fn ($app) => new TestRequest(),
692+
'implementation' => fn ($app) => new TestRequest(),
695693
],
696694
];
697695
}
698696

699-
#[DataProvider('addDataWithBindingInterface')]
700-
public function testAddDataWithBindingInterface($concrete)
697+
#[DataProvider('getImplementations')]
698+
public function testAddDataWithBindingInterface($implementation)
701699
{
702-
$this->app->bind(TestContract::class, $concrete);
700+
$this->app->bind(TestContract::class, $implementation);
703701

704702
$this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_get_user_request'));
705703

0 commit comments

Comments
 (0)