Skip to content

Commit d03dd96

Browse files
committed
Swap empty with explicit string comparison.
1 parent 7eb268e commit d03dd96

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/Artisan/stubs/value-object.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class {{ class }} extends ValueObject
6767
{
6868
// TODO: Implement validate() method.
6969

70-
if (empty($this->value())) {
70+
if ($this->value() === '') {
7171
throw ValidationException::withMessages(['Value of {{ class }} cannot be empty.']);
7272
}
7373
}

src/Collection/Complex/ClassString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function value(): string
114114
*/
115115
protected function validate(): void
116116
{
117-
if (empty($this->value())) {
117+
if ($this->value() === '') {
118118
throw ValidationException::withMessages(['Class string cannot be empty.']);
119119
}
120120
}

src/Collection/Complex/FullName.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function toArray(): array
102102
*/
103103
protected function validate(): void
104104
{
105-
if (empty($this->value())) {
105+
if ($this->value() === '') {
106106
throw ValidationException::withMessages(['Full name cannot be empty.']);
107107
}
108108

src/Collection/Complex/TaxNumber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function toArray(): array
141141
*/
142142
protected function validate(): void
143143
{
144-
if (empty($this->value())) {
144+
if ($this->value() === '') {
145145
throw ValidationException::withMessages(['Tax number cannot be empty.']);
146146
}
147147
}

src/Collection/Primitive/Text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function value(): string
7474
*/
7575
protected function validate(): void
7676
{
77-
if (empty($this->value())) {
77+
if ($this->value() === '') {
7878
throw new InvalidArgumentException('Text cannot be empty.');
7979
}
8080
}

0 commit comments

Comments
 (0)