Skip to content

Commit 0cf75aa

Browse files
committed
Made deprecation reason not nullable.
1 parent 9db49d9 commit 0cf75aa

7 files changed

Lines changed: 66 additions & 62 deletions

File tree

composer.lock

Lines changed: 51 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Typesystem/Spec/DeprecatedDirective.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ final class DeprecatedDirective extends Directive implements
2525
EnumItemLocation,
2626
ArgumentDefinitionLocation
2727
{
28+
public const DEFAULT_MESSAGE = 'No longer supported';
2829
protected const NAME = 'deprecated';
2930

3031
#[\Override]
@@ -90,7 +91,7 @@ protected function getFieldDefinition() : ArgumentSet
9091
{
9192
return new ArgumentSet([
9293
Argument::create('reason', Container::String()->notNull())
93-
->setDefaultValue('No longer supported'),
94+
->setDefaultValue(self::DEFAULT_MESSAGE),
9495
]);
9596
}
9697
}

src/Typesystem/Utils/TDeprecatable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
trait TDeprecatable
1414
{
15-
public function setDeprecated(?string $reason = null) : self
15+
public function setDeprecated(string $reason = DeprecatedDirective::DEFAULT_MESSAGE) : self
1616
{
1717
$this->addDirective(
1818
Container::directiveDeprecated(),
@@ -41,7 +41,7 @@ public function getDeprecationReason() : ?string
4141

4242
return \is_string($value)
4343
? $value
44-
: null;
44+
: DeprecatedDirective::DEFAULT_MESSAGE;
4545
}
4646
}
4747

0 commit comments

Comments
 (0)