Skip to content

Commit

Permalink
Update syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk committed Nov 1, 2022
1 parent 2c222d3 commit 3547664
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
6 changes: 1 addition & 5 deletions src/Casts/NameCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@

class NameCast implements CastsAttributes
{
protected ?string $firstName;

protected ?string $lastName;

public function __construct(?string $firstName = null, ?string $lastName = null)
public function __construct(protected ?string $firstName = null, protected ?string $lastName = null)
{
$this->firstName = $firstName ?: 'first_name';
$this->lastName = $lastName ?: 'last_name';
Expand Down
8 changes: 1 addition & 7 deletions src/Support/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
*/
class Name implements JsonSerializable, Jsonable, Castable
{
protected ?string $firstName;

protected ?string $lastName;

public static function from(?string $name): self
{
$parts = explode(' ', trim($name), 2);
Expand All @@ -43,10 +39,8 @@ public static function from(?string $name): self
return new static(Arr::get($parts, 0), $lastName);
}

public function __construct(?string $firstName, ?string $lastName = null)
public function __construct(protected ?string $firstName, protected ?string $lastName = null)
{
$this->firstName = $firstName;
$this->lastName = $lastName;
}

public function first(): ?string
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Str as BaseStr;

/** @internal */
class Str extends BaseStr
final class Str extends BaseStr
{
public static function firstLetter(string $value): string
{
Expand Down

0 comments on commit 3547664

Please sign in to comment.