apply php cs fixes

This commit is contained in:
prolic 2018-06-29 18:15:39 +08:00
parent e20aa137bb
commit 81d163fb66
No known key found for this signature in database
GPG Key ID: 29722F9F48E9DE59
13 changed files with 33 additions and 17 deletions

View File

@ -2,11 +2,12 @@
namespace Amp\Sql; namespace Amp\Sql;
interface CommandResult { interface CommandResult
{
/** /**
* Returns the number of rows affected by the query. * Returns the number of rows affected by the query.
* *
* @return int * @return int
*/ */
public function affectedRows(): int; public function affectedRows(): int;
} }

View File

@ -2,5 +2,6 @@
namespace Amp\Sql; namespace Amp\Sql;
class ConnectionException extends FailureException { class ConnectionException extends FailureException
{
} }

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Connector { interface Connector
{
/** /**
* @param ConnectionConfig $config * @param ConnectionConfig $config
* *

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Executor { interface Executor
{
/** /**
* @param string $sql SQL query to execute. * @param string $sql SQL query to execute.
* *

View File

@ -2,5 +2,6 @@
namespace Amp\Sql; namespace Amp\Sql;
class FailureException extends \Exception { class FailureException extends \Exception
{
} }

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Link extends Executor { interface Link extends Executor
{
/** /**
* Starts a transaction on a single connection. * Starts a transaction on a single connection.
* *

View File

@ -2,7 +2,8 @@
namespace Amp\Sql; namespace Amp\Sql;
interface Operation { interface Operation
{
/** /**
* @param callable $onDestruct Callback executed when the operation completes or the object is destroyed. * @param callable $onDestruct Callback executed when the operation completes or the object is destroyed.
*/ */

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Pool extends Link { interface Pool extends Link
{
const DEFAULT_MAX_CONNECTIONS = 100; const DEFAULT_MAX_CONNECTIONS = 100;
const DEFAULT_IDLE_TIMEOUT = 60; const DEFAULT_IDLE_TIMEOUT = 60;

View File

@ -2,5 +2,6 @@
namespace Amp\Sql; namespace Amp\Sql;
class PoolError extends \Error { class PoolError extends \Error
{
} }

View File

@ -2,21 +2,25 @@
namespace Amp\Sql; namespace Amp\Sql;
class QueryError extends \Error { class QueryError extends \Error
{
protected $query = ""; protected $query = "";
public function __construct(string $message, string $query = "", \Throwable $previous = null) { public function __construct(string $message, string $query = "", \Throwable $previous = null)
{
if ($query != "") { if ($query != "") {
$this->query = $query; $this->query = $query;
} }
parent::__construct($message, 0, $previous); parent::__construct($message, 0, $previous);
} }
final public function getQuery(): string { final public function getQuery(): string
{
return $this->query; return $this->query;
} }
public function __toString(): string { public function __toString(): string
{
if ($this->query == "") { if ($this->query == "") {
return parent::__toString(); return parent::__toString();
} }

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Statement { interface Statement
{
/** /**
* @param mixed[] $params * @param mixed[] $params
* *

View File

@ -4,7 +4,8 @@ namespace Amp\Sql;
use Amp\Promise; use Amp\Promise;
interface Transaction extends Executor, Operation { interface Transaction extends Executor, Operation
{
const ISOLATION_UNCOMMITTED = 0; const ISOLATION_UNCOMMITTED = 0;
const ISOLATION_COMMITTED = 1; const ISOLATION_COMMITTED = 1;
const ISOLATION_REPEATABLE = 2; const ISOLATION_REPEATABLE = 2;

View File

@ -2,5 +2,6 @@
namespace Amp\Sql; namespace Amp\Sql;
class TransactionError extends \Error { class TransactionError extends \Error
{
} }