Skip to content

Commit 9ffa94d

Browse files
committed
Ensure setterMethod is always a string
1 parent 4a24e87 commit 9ffa94d

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

src/Mapping/Annotation/Blameable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class Blameable implements GedmoAnnotation
3333
public $field;
3434
/** @var mixed */
3535
public $value;
36-
/** @var string|null */
36+
/** @var string */
3737
public $setterMethod;
3838

3939
/**
@@ -46,7 +46,7 @@ public function __construct(
4646
string $on = 'update',
4747
$field = null,
4848
$value = null,
49-
?string $setterMethod = null
49+
string $setterMethod = ''
5050
) {
5151
if ([] !== $data) {
5252
@trigger_error(sprintf(

src/Mapping/Annotation/IpTraceable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class IpTraceable implements GedmoAnnotation
3434
public $field;
3535
/** @var mixed */
3636
public $value;
37-
/** @var string|null */
37+
/** @var string */
3838
public $setterMethod;
3939

4040
/**
@@ -47,7 +47,7 @@ public function __construct(
4747
string $on = 'update',
4848
$field = null,
4949
$value = null,
50-
?string $setterMethod = null
50+
string $setterMethod = ''
5151
) {
5252
if ([] !== $data) {
5353
@trigger_error(sprintf(

src/Mapping/Annotation/SoftDeleteable.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ final class SoftDeleteable implements GedmoAnnotation
3434

3535
public bool $hardDelete = true;
3636

37-
/** @var string|null */
37+
/** @var string */
3838
public $setterMethod;
3939

4040
/**
4141
* @param array<string, mixed> $data
4242
*/
43-
public function __construct(array $data = [], string $fieldName = 'deletedAt', bool $timeAware = false, bool $hardDelete = true, ?string $setterMethod = null)
44-
{
43+
public function __construct(
44+
array $data = [],
45+
string $fieldName = 'deletedAt',
46+
bool $timeAware = false,
47+
bool $hardDelete = true,
48+
string $setterMethod = ''
49+
) {
4550
if ([] !== $data) {
4651
@trigger_error(sprintf(
4752
'Passing an array as first argument to "%s()" is deprecated. Use named arguments instead.',

src/Mapping/Annotation/Timestampable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class Timestampable implements GedmoAnnotation
3333
public $field;
3434
/** @var mixed */
3535
public $value;
36-
/** @var string|null */
36+
/** @var string */
3737
public $setterMethod;
3838

3939
/**
@@ -46,7 +46,7 @@ public function __construct(
4646
string $on = 'update',
4747
$field = null,
4848
$value = null,
49-
?string $setterMethod = null
49+
string $setterMethod = ''
5050
) {
5151
if ([] !== $data) {
5252
@trigger_error(sprintf(

src/Mapping/Driver/AbstractAnnotationDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ protected function getRelatedClassName($metadata, $name)
138138
/**
139139
* Set the setter method for the given field.
140140
*/
141-
protected function setSetterMethod(string $field, ?string $method, array &$config): void
141+
protected function setSetterMethod(string $field, string $method, array &$config): void
142142
{
143-
if (empty($method)) {
143+
if ('' === $method) {
144144
return;
145145
}
146146

0 commit comments

Comments
 (0)