Skip to content

Commit 46e3b15

Browse files
committed
Ensure setterMethod is always a string
1 parent f86b03b commit 46e3b15

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
@@ -32,7 +32,7 @@ final class Blameable implements GedmoAnnotation
3232
public $field;
3333
/** @var mixed */
3434
public $value;
35-
/** @var string|null */
35+
/** @var string */
3636
public $setterMethod;
3737

3838
/**
@@ -45,7 +45,7 @@ public function __construct(
4545
string $on = 'update',
4646
$field = null,
4747
$value = null,
48-
?string $setterMethod = null
48+
string $setterMethod = ''
4949
) {
5050
if ([] !== $data) {
5151
@trigger_error(sprintf(

src/Mapping/Annotation/IpTraceable.php

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

3838
/**
@@ -45,7 +45,7 @@ public function __construct(
4545
string $on = 'update',
4646
$field = null,
4747
$value = null,
48-
?string $setterMethod = null
48+
string $setterMethod = ''
4949
) {
5050
if ([] !== $data) {
5151
@trigger_error(sprintf(

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
/** @var bool */
3636
public $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
@trigger_error(sprintf(
4853
'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
@@ -32,7 +32,7 @@ final class Timestampable implements GedmoAnnotation
3232
public $field;
3333
/** @var mixed */
3434
public $value;
35-
/** @var string|null */
35+
/** @var string */
3636
public $setterMethod;
3737

3838
/**
@@ -45,7 +45,7 @@ public function __construct(
4545
string $on = 'update',
4646
$field = null,
4747
$value = null,
48-
?string $setterMethod = null
48+
string $setterMethod = ''
4949
) {
5050
if ([] !== $data) {
5151
@trigger_error(sprintf(

src/Mapping/Driver/AbstractAnnotationDriver.php

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

0 commit comments

Comments
 (0)