Skip to content

Commit 3547664

Browse files
committed
Update syntax
1 parent 2c222d3 commit 3547664

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

src/Casts/NameCast.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010

1111
class NameCast implements CastsAttributes
1212
{
13-
protected ?string $firstName;
14-
15-
protected ?string $lastName;
16-
17-
public function __construct(?string $firstName = null, ?string $lastName = null)
13+
public function __construct(protected ?string $firstName = null, protected ?string $lastName = null)
1814
{
1915
$this->firstName = $firstName ?: 'first_name';
2016
$this->lastName = $lastName ?: 'last_name';

src/Support/Name.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
*/
2929
class Name implements JsonSerializable, Jsonable, Castable
3030
{
31-
protected ?string $firstName;
32-
33-
protected ?string $lastName;
34-
3531
public static function from(?string $name): self
3632
{
3733
$parts = explode(' ', trim($name), 2);
@@ -43,10 +39,8 @@ public static function from(?string $name): self
4339
return new static(Arr::get($parts, 0), $lastName);
4440
}
4541

46-
public function __construct(?string $firstName, ?string $lastName = null)
42+
public function __construct(protected ?string $firstName, protected ?string $lastName = null)
4743
{
48-
$this->firstName = $firstName;
49-
$this->lastName = $lastName;
5044
}
5145

5246
public function first(): ?string

src/Support/Str.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Illuminate\Support\Str as BaseStr;
88

99
/** @internal */
10-
class Str extends BaseStr
10+
final class Str extends BaseStr
1111
{
1212
public static function firstLetter(string $value): string
1313
{

0 commit comments

Comments
 (0)