Skip to content

Commit 2c62b57

Browse files
committed
Ensure setterMethod is always a string
1 parent aa7cd64 commit 2c62b57

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
@@ -34,7 +34,7 @@ final class Blameable 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
Deprecation::trigger(

src/Mapping/Annotation/IpTraceable.php

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

4141
/**
@@ -48,7 +48,7 @@ public function __construct(
4848
string $on = 'update',
4949
$field = null,
5050
$value = null,
51-
?string $setterMethod = null
51+
string $setterMethod = ''
5252
) {
5353
if ([] !== $data) {
5454
Deprecation::trigger(

src/Mapping/Annotation/SoftDeleteable.php

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

3636
public bool $hardDelete = true;
3737

38-
/** @var string|null */
38+
/** @var string */
3939
public $setterMethod;
4040

4141
/**
4242
* @param array<string, mixed> $data
4343
*/
44-
public function __construct(array $data = [], string $fieldName = 'deletedAt', bool $timeAware = false, bool $hardDelete = true, ?string $setterMethod = null)
45-
{
44+
public function __construct(
45+
array $data = [],
46+
string $fieldName = 'deletedAt',
47+
bool $timeAware = false,
48+
bool $hardDelete = true,
49+
string $setterMethod = ''
50+
) {
4651
if ([] !== $data) {
4752
Deprecation::trigger(
4853
'gedmo/doctrine-extensions',

src/Mapping/Annotation/Timestampable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class Timestampable 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
Deprecation::trigger(

src/Mapping/Driver/AbstractAnnotationDriver.php

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

0 commit comments

Comments
 (0)