@@ -53,7 +53,7 @@ abstract class Model implements \JsonSerializable
5353 /**
5454 * @return Query
5555 */
56- public static function createQuery () : Query
56+ public static function createQuery (): Query
5757 {
5858 $ query = self ::getConnection ()->createQuery ();
5959 $ query ->from (self ::getTable ());
@@ -68,7 +68,7 @@ public static function createQuery() : Query
6868 *
6969 * @return static[]
7070 */
71- public static function find (\Closure $ filterFn = null , bool $ applySetters = false ) : array
71+ public static function find (\Closure $ filterFn = null , bool $ applySetters = false ): array
7272 {
7373 $ connection = self ::getConnection ();
7474 $ table = self ::getModelProperty ('table ' );
@@ -95,7 +95,9 @@ public static function find(\Closure $filterFn = null, bool $applySetters = fals
9595 $ rowData = $ row ->getData ();
9696
9797 foreach (self ::getDateFields () as $ dateField ) {
98- if (empty ($ rowData [$ dateField ])) continue ;
98+ if (empty ($ rowData [$ dateField ])) {
99+ continue ;
100+ }
99101
100102 $ rowData [$ dateField ] = date_create_from_format (
101103 $ connection ->getDateFormat (),
@@ -115,47 +117,47 @@ public static function find(\Closure $filterFn = null, bool $applySetters = fals
115117 /**
116118 * @return Connection
117119 */
118- final public static function getConnection () : Connection
120+ final public static function getConnection (): Connection
119121 {
120122 return self ::getModelProperty ('connection ' );
121123 }
122124
123125 /**
124126 * @return array
125127 */
126- final public static function getDateFields () : array
128+ final public static function getDateFields (): array
127129 {
128130 return self ::getModelProperty ('dateFields ' );
129131 }
130132
131133 /**
132134 * @return array
133135 */
134- final public static function getFields () : array
136+ final public static function getFields (): array
135137 {
136138 return self ::getModelProperty ('fields ' );
137139 }
138140
139141 /**
140142 * @return array
141143 */
142- final public static function getPrimaryKeys () : array
144+ final public static function getPrimaryKeys (): array
143145 {
144146 return self ::getModelProperty ('primaryKeys ' );
145147 }
146148
147149 /**
148150 * @return string
149151 */
150- final public static function getTable () : string
152+ final public static function getTable (): string
151153 {
152154 return self ::getModelProperty ('table ' );
153155 }
154156
155157 /**
156158 * @return bool
157159 */
158- final public static function hasTimestamps () : bool
160+ final public static function hasTimestamps (): bool
159161 {
160162 return self ::getModelProperty ('timestamps ' );
161163 }
@@ -186,7 +188,9 @@ public static function load($primary, bool $applySetters = false)
186188 $ rowData = $ result ->fetch ()->getData ();
187189
188190 foreach (self ::getDateFields () as $ dateField ) {
189- if (empty ($ rowData [$ dateField ])) continue ;
191+ if (empty ($ rowData [$ dateField ])) {
192+ continue ;
193+ }
190194
191195 $ rowData [$ dateField ] = date_create_from_format (
192196 $ connection ->getDateFormat (),
@@ -251,7 +255,7 @@ private static function initModelProperties()
251255 *
252256 * @return array
253257 */
254- private static function normalizePrimaryKeys ($ primary ) : array
258+ private static function normalizePrimaryKeys ($ primary ): array
255259 {
256260 $ pks = self ::getPrimaryKeys ();
257261
@@ -269,7 +273,7 @@ private static function normalizePrimaryKeys($primary) : array
269273 *
270274 * @return bool
271275 */
272- public function delete () : bool
276+ public function delete (): bool
273277 {
274278 $ result = self ::getConnection ()->delete ($ this );
275279
@@ -281,7 +285,7 @@ public function delete() : bool
281285 *
282286 * @return bool
283287 */
284- public function exists () : bool
288+ public function exists (): bool
285289 {
286290 $ query = static ::createQuery ();
287291 $ pks = static ::getPrimaryKeys ();
@@ -336,7 +340,7 @@ final public function fill(array $data, $applySetters = true)
336340 /**
337341 * @return array
338342 */
339- final public function getData () : array
343+ final public function getData (): array
340344 {
341345 return $ this ->data ;
342346 }
@@ -347,7 +351,7 @@ final public function getData() : array
347351 *
348352 * @return array
349353 */
350- final public function getPrimaryKeyValues () : array
354+ final public function getPrimaryKeyValues (): array
351355 {
352356 $ keys = static ::getPrimaryKeys ();
353357 $ values = array_intersect_key ($ this ->data , array_flip ($ keys ));
@@ -360,7 +364,7 @@ final public function getPrimaryKeyValues() : array
360364 *
361365 * @return Result
362366 */
363- public function insert () : Result
367+ public function insert (): Result
364368 {
365369 $ result = self ::getConnection ()->insert ($ this );
366370
@@ -454,7 +458,7 @@ public function relatedToOne(
454458 *
455459 * @return bool
456460 */
457- public function save (array $ data = []) : bool
461+ public function save (array $ data = []): bool
458462 {
459463 $ this ->fill ($ data );
460464 $ result = null ;
@@ -473,7 +477,7 @@ public function save(array $data = []) : bool
473477 *
474478 * @return Result
475479 */
476- public function update () : Result
480+ public function update (): Result
477481 {
478482 return self ::getConnection ()->update ($ this );
479483 }
@@ -498,7 +502,7 @@ private function applyModifier(string $fieldName, &$value, $methodPrefix)
498502 *
499503 * @return string
500504 */
501- private function fieldNameToUpperCamelCase (string $ fieldName ) : string
505+ private function fieldNameToUpperCamelCase (string $ fieldName ): string
502506 {
503507 $ handler = function ($ matches ) {
504508 return strtoupper ($ matches [0 ][1 ]);
0 commit comments