@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param Closure|null $close an optional anonymous function that takes the connection as arguments and closes it |
| 30 | 30 | * @throws InvalidArgumentException if connection $name already exists |
| 31 | 31 | */ |
| 32 | - public static function add(string $name, Closure $open, ?Closure $close = null): void |
|
| 32 | + public static function add(string $name, Closure $open, ? Closure $close = null) : void |
|
| 33 | 33 | { |
| 34 | 34 | if (isset(self::$open[$name])) { |
| 35 | 35 | throw new InvalidArgumentException("Connection $name already exists"); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return self::$settings[$environment][$config_name]; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public static function grab(?string $environment = null): array |
|
| 59 | + public static function grab(? string $environment = null) : array |
|
| 60 | 60 | { |
| 61 | 61 | if (is_null($environment)) { |
| 62 | 62 | $environment = static::current(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param mixed $value |
| 75 | 75 | * @param null|string $environment if not specified, configures CURRENT environment only. E::ALL, sets for all envs. |
| 76 | 76 | */ |
| 77 | - public static function put(string $config_name, $value, ?string $environment = null): void |
|
| 77 | + public static function put(string $config_name, $value, ? string $environment = null) : void |
|
| 78 | 78 | { |
| 79 | 79 | if (is_null($environment)) { |
| 80 | 80 | $environment = static::current(); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param array $configs |
| 99 | 99 | * @param null|string $environment |
| 100 | 100 | */ |
| 101 | - public static function add(array $configs, ?string $environment = null): void |
|
| 101 | + public static function add(array $configs, ? string $environment = null) : void |
|
| 102 | 102 | { |
| 103 | 103 | if (is_null($environment)) { |
| 104 | 104 | $environment = static::current(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param array $configs |
| 123 | 123 | * @param null|string $environment |
| 124 | 124 | */ |
| 125 | - public static function set(array $configs, ?string $environment = null): void |
|
| 125 | + public static function set(array $configs, ? string $environment = null) : void |
|
| 126 | 126 | { |
| 127 | 127 | if (is_null($environment)) { |
| 128 | 128 | $environment = static::current(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | throw new \Exception("Query method is not implemented for MongDB"); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function one(string $collection_name, array $conditions, array $options = []): ?array |
|
| 81 | + public function one(string $collection_name, array $conditions, array $options = []): ? array |
|
| 82 | 82 | { |
| 83 | 83 | $collection = $this->collection($collection_name); |
| 84 | 84 | $conditions = $this->idReplaceConditions($conditions); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | return $result->getModifiedCount() ?? 0; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function insert(string $collection, array $data, array $options = []): ?ObjectID |
|
| 132 | + public function insert(string $collection, array $data, array $options = []): ? ObjectID |
|
| 133 | 133 | { |
| 134 | 134 | $collection = $this->collection($collection); |
| 135 | 135 | $result = $collection->insertOne($data, $options); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | unset($options['with']); |
| 79 | 79 | $result = static::db()->find(static::table(), $conditions, $options); |
| 80 | 80 | $pk = static::pk(); |
| 81 | - $gen = function () use ($result, $pk, $with) { |
|
| 81 | + $gen = function() use ($result, $pk, $with) { |
|
| 82 | 82 | foreach ($result as $row) { |
| 83 | 83 | $model = new static($row); |
| 84 | 84 | if ($with) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return iterator_to_array($generator); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public static function fields(): ?array |
|
| 115 | + public static function fields(): ? array |
|
| 116 | 116 | { |
| 117 | 117 | return isset(static::$fields) ? static::$fields : null; |
| 118 | 118 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (empty($fields) === false) { |
| 124 | 124 | $data = array_filter( |
| 125 | 125 | $data, |
| 126 | - function ($key) use ($fields) { |
|
| 126 | + function($key) use ($fields) { |
|
| 127 | 127 | return in_array($key, $fields); |
| 128 | 128 | }, |
| 129 | 129 | ARRAY_FILTER_USE_KEY |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->data = $data; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - abstract public static function fields(): ?array; |
|
| 36 | + abstract public static function fields(): ? array; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @param $name |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function __call(string $method, array $args = []) |
| 48 | 48 | { |
| 49 | - $refresh = (bool) array_shift($args); |
|
| 49 | + $refresh = (bool)array_shift($args); |
|
| 50 | 50 | return $this->getRelatedModel($method, $refresh); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function query($query, array $params = []); |
| 10 | 10 | |
| 11 | - public function one(string $table, array $conditions, array $options = []):?array; |
|
| 11 | + public function one(string $table, array $conditions, array $options = []): ? array; |
|
| 12 | 12 | |
| 13 | 13 | public function find(string $table, array $conditions, array $options = []); |
| 14 | 14 | |
@@ -9,5 +9,5 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function url(): string; |
| 11 | 11 | public function parameters(): array; |
| 12 | - public function __invoke(Request $request): ?Response; |
|
| 12 | + public function __invoke(Request $request): ? Response; |
|
| 13 | 13 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $this->chain = $chained_callable; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function next(Request $request): ?Response |
|
| 14 | + public function next(Request $request): ? Response |
|
| 15 | 15 | { |
| 16 | 16 | if (empty($this->chain)) { |
| 17 | 17 | throw new exceptions\EmptyChainError; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param Closure $cb |
| 34 | 34 | * @param array $parameters |
| 35 | 35 | */ |
| 36 | - public function __construct(string $url, ?Closure $cb, array $parameters = []) |
|
| 36 | + public function __construct(string $url, ? Closure $cb, array $parameters = []) |
|
| 37 | 37 | { |
| 38 | 38 | $this->url = $url; |
| 39 | 39 | $this->callback = $cb; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @return Response|null |
| 56 | 56 | * @throws InvalidCallback if callback did not return Response|null |
| 57 | 57 | */ |
| 58 | - public function __invoke(Request $request): ?Response |
|
| 58 | + public function __invoke(Request $request): ? Response |
|
| 59 | 59 | { |
| 60 | 60 | $response = call_user_func_array($this->callback, [$request]); |
| 61 | 61 | if (is_null($response) || $response instanceof Response) { |