Skip to content

Commit

Permalink
Merge pull request #109 from gsteel/merge-release-2.30.1-into-2.31.x
Browse files Browse the repository at this point in the history
Merge release 2.30.1 into 2.31.x
  • Loading branch information
gsteel committed Apr 3, 2024
2 parents 1d3a336 + f07a908 commit 9d449dd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
6 changes: 6 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<file src="src/ArrayInput.php">
<DeprecatedProperty>
<code><![CDATA[$this->value]]></code>
<code><![CDATA[$this->value]]></code>
<code><![CDATA[$this->value]]></code>
<code><![CDATA[$this->value]]></code>
</DeprecatedProperty>
<InvalidPropertyAssignmentValue>
<code><![CDATA[$this->prepareNotArrayFailureMessage()]]></code>
<code><![CDATA[$this->prepareRequiredValidationFailureMessage()]]></code>
Expand Down
19 changes: 19 additions & 0 deletions src/ArrayInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,25 @@

class ArrayInput extends Input
{
/**
* @deprecated since 2.30.1 The default value should be null as in parent `Input`
*
* @var mixed
*/
protected $value = [];

/**
* @deprecated since 2.30.1 Once the default value is null, this method is no longer required
*
* @inheritDoc
*/
public function resetValue()
{
$this->value = [];
$this->hasValue = false;
return $this;
}

/** @inheritDoc */
public function getValue()
{
Expand Down
6 changes: 5 additions & 1 deletion test/ArrayInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ protected function setUp(): void
$this->input = new ArrayInput('foo');
}

/**
* @deprecated Since 2.30.1 The default value should be null in the next major,
* therefore this test can be dropped in favour of parent::testDefaultGetValue()
*/
public function testDefaultGetValue(): void
{
self::assertNull($this->input->getValue());
self::assertSame([], $this->input->getValue());
}

public function testArrayInputMarkedRequiredWithoutAFallbackFailsValidationForEmptyArrays(): void
Expand Down

0 comments on commit 9d449dd

Please sign in to comment.