Skip to content

Commit

Permalink
minor #52334 [Yaml]  Inline::parse(null) not allowed (GromNaN)
Browse files Browse the repository at this point in the history
This PR was merged into the 6.4 branch.

Discussion
----------

[Yaml]  `Inline::parse(null)` not allowed

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #52326
| License       | MIT

It's only called with string values in the Yaml component.

This class is internal. It allows to change the arg type.
The arg type was documented as `string`.
symfony/symfony@7b1715b#diff-1d97fcfb29e99f0200c3952e9a1a11c4b9f825c0f5ad4d4515b9b1805f8c988eR47

Commits
-------

834e0ab6e2 Passing null to Inline::parse is not allowed
  • Loading branch information
fabpot committed Oct 28, 2023
2 parents 245813a + 4dcbd69 commit fa5302a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function initialize(int $flags, int $parsedLineNumber = null, stri
*
* @throws ParseException
*/
public static function parse(string $value = null, int $flags = 0, array &$references = []): mixed
public static function parse(string $value, int $flags = 0, array &$references = []): mixed
{
if (null === $value) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void
/**
* @dataProvider getTestsForParse
*/
public function testParse($yaml, $value, $flags = 0)
public function testParse(string $yaml, $value, $flags = 0)
{
$this->assertSame($value, Inline::parse($yaml, $flags), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
}
Expand Down

0 comments on commit fa5302a

Please sign in to comment.