Skip to content

Commit

Permalink
Add ProviderInterface generic type in phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Apr 26, 2022
1 parent 94cd68e commit 5795c9a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
7 changes: 4 additions & 3 deletions src/AuraSqlQueryDeleteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ray\AuraSqlModule\Annotation\AuraSqlQueryConfig;
use Ray\Di\ProviderInterface;

/**
* @implements ProviderInterface<DeleteInterface>
*/
class AuraSqlQueryDeleteProvider implements ProviderInterface
{
private string $db;
Expand All @@ -26,10 +29,8 @@ public function __construct(string $db)

/**
* {@inheritdoc}
*
* @return DeleteInterface
*/
public function get()
public function get(): DeleteInterface
{
return (new QueryFactory($this->db))->newDelete();
}
Expand Down
7 changes: 4 additions & 3 deletions src/AuraSqlQueryInsertProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ray\AuraSqlModule\Annotation\AuraSqlQueryConfig;
use Ray\Di\ProviderInterface;

/**
* @implements ProviderInterface<InsertInterface>
*/
class AuraSqlQueryInsertProvider implements ProviderInterface
{
private string $db;
Expand All @@ -26,10 +29,8 @@ public function __construct(string $db)

/**
* {@inheritdoc}
*
* @return InsertInterface
*/
public function get()
public function get(): InsertInterface
{
return (new QueryFactory($this->db))->newInsert();
}
Expand Down
7 changes: 4 additions & 3 deletions src/AuraSqlQuerySelectProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ray\AuraSqlModule\Annotation\AuraSqlQueryConfig;
use Ray\Di\ProviderInterface;

/**
* @implements ProviderInterface<SelectInterface>
*/
class AuraSqlQuerySelectProvider implements ProviderInterface
{
private string $db;
Expand All @@ -26,10 +29,8 @@ public function __construct($db)

/**
* {@inheritdoc}
*
* @return SelectInterface
*/
public function get()
public function get(): SelectInterface
{
return (new QueryFactory($this->db))->newSelect();
}
Expand Down
7 changes: 4 additions & 3 deletions src/AuraSqlQueryUpdateProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ray\AuraSqlModule\Annotation\AuraSqlQueryConfig;
use Ray\Di\ProviderInterface;

/**
* @implements ProviderInterface<UpdateInterface>
*/
class AuraSqlQueryUpdateProvider implements ProviderInterface
{
private string $db;
Expand All @@ -26,10 +29,8 @@ public function __construct($db)

/**
* {@inheritdoc}
*
* @return UpdateInterface
*/
public function get()
public function get(): UpdateInterface
{
return (new QueryFactory($this->db))->newUpdate();
}
Expand Down
9 changes: 5 additions & 4 deletions src/AuraSqlReplicationDbProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
namespace Ray\AuraSqlModule;

use Aura\Sql\ConnectionLocatorInterface;
use Aura\Sql\PdoInterface;
use Aura\Sql\ExtendedPdoInterface;
use Ray\Di\InjectorInterface;
use Ray\Di\ProviderInterface;
use Ray\Di\SetContextInterface;

use function assert;

/**
* @implements ProviderInterface<ExtendedPdoInterface>
*/
class AuraSqlReplicationDbProvider implements ProviderInterface, SetContextInterface
{
private InjectorInterface $injector;
Expand All @@ -34,10 +37,8 @@ public function setContext($context): void

/**
* {@inheritdoc}
*
* @return PdoInterface
*/
public function get()
public function get(): ExtendedPdoInterface
{
$connectionLocator = $this->injector->getInstance(ConnectionLocatorInterface::class, $this->context);
assert($connectionLocator instanceof ConnectionLocatorInterface);
Expand Down

0 comments on commit 5795c9a

Please sign in to comment.