Skip to content

Commit 8e11e7b

Browse files
committed
refactor: adds explicit nullable types
1 parent d04c812 commit 8e11e7b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/Models/Contracts/Model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getDirty() : array;
5656
*
5757
* @return mixed|array
5858
*/
59-
public function getOriginal( string $key = null );
59+
public function getOriginal( ?string $key = null );
6060

6161
/**
6262
* Determines if the model has the given property.
@@ -79,7 +79,7 @@ public static function hasProperty( string $key ) : bool;
7979
*
8080
* @return bool
8181
*/
82-
public function isClean( string $attribute = null ) : bool;
82+
public function isClean( ?string $attribute = null ) : bool;
8383

8484
/**
8585
* Determines if a given attribute is dirty.
@@ -90,7 +90,7 @@ public function isClean( string $attribute = null ) : bool;
9090
*
9191
* @return bool
9292
*/
93-
public function isDirty( string $attribute = null ) : bool;
93+
public function isDirty( ?string $attribute = null ) : bool;
9494

9595
/**
9696
* Validates an attribute to a PHP type.

src/Models/Model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function getDirty() : array {
157157
*
158158
* @return mixed|array
159159
*/
160-
public function getOriginal( string $key = null ) {
160+
public function getOriginal( ?string $key = null ) {
161161
return $key ? $this->original[ $key ] : $this->original;
162162
}
163163

@@ -322,7 +322,7 @@ public static function hasProperty( string $key ) : bool {
322322
*
323323
* @return bool
324324
*/
325-
public function isClean( string $attribute = null ) : bool {
325+
public function isClean( ?string $attribute = null ) : bool {
326326
return ! $this->isDirty( $attribute );
327327
}
328328

@@ -335,7 +335,7 @@ public function isClean( string $attribute = null ) : bool {
335335
*
336336
* @return bool
337337
*/
338-
public function isDirty( string $attribute = null ) : bool {
338+
public function isDirty( ?string $attribute = null ) : bool {
339339
if ( ! $attribute ) {
340340
return (bool) $this->getDirty();
341341
}

src/Models/ModelQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct( string $modelClass ) {
4040
*
4141
* @param null|string $column
4242
*/
43-
public function count( $column = null ) : int {
43+
public function count( ?string $column = null ) : int {
4444
$column = ( ! $column || $column === '*' ) ? '1' : trim( $column );
4545

4646
if ( '1' === $column ) {

0 commit comments

Comments
 (0)