Skip to content

Commit

Permalink
Merge pull request #64 from ray-di/option-array-type
Browse files Browse the repository at this point in the history
Fix option array type in phpdoc
  • Loading branch information
koriym committed Apr 26, 2022
2 parents f878980 + 591f9e9 commit 92f0af8
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 388 deletions.
12 changes: 6 additions & 6 deletions src/AuraSqlModule.php
Expand Up @@ -24,15 +24,15 @@ class AuraSqlModule extends AbstractModule
private string $password;
private string $slave;

/** @var array<string> */
/** @var array<mixed> */
private array $options;

/**
* @param string $dsn Data Source Name (DSN)
* @param string $user User name for the DSN string
* @param string $password Password for the DSN string
* @param string $slave Comma separated slave host list
* @phpstan-param array<string> $options A key=>value array of driver-specific connection options
* @param string $dsn Data Source Name (DSN)
* @param string $user User name for the DSN string
* @param string $password Password for the DSN string
* @param string $slave Comma separated slave host list
* @param array<mixed> $options A key=>value array of driver-specific connection options
*/
public function __construct(string $dsn, string $user = '', string $password = '', string $slave = '', array $options = [])
{
Expand Down
7 changes: 4 additions & 3 deletions src/AuraSqlQueryDeleteProvider.php
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
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
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
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
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 92f0af8

Please sign in to comment.