Merge branch '5.1' into 5.2
* 5.1: Fix merge. fix lexing mapping values with trailing whitespaces [String] Fix Notice when argument is empty string [Inflector] Fix Notice when argument is empty string Fix small typos
This commit is contained in:
commit
56e79395c4
@ -10,8 +10,8 @@ CHANGELOG
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
* Added argument `$selector` to ``Crawler::children()`
|
||||
* Added argument `$default` to ``Crawler::text()` and `html()`
|
||||
* Added argument `$selector` to `Crawler::children()`
|
||||
* Added argument `$default` to `Crawler::text()` and `html()`
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -323,4 +323,16 @@ class InflectorTest extends TestCase
|
||||
|
||||
$this->assertEquals($expectedPlural, $plural);
|
||||
}
|
||||
|
||||
public function testPluralizeEmptyString()
|
||||
{
|
||||
$plural = Inflector::pluralize('');
|
||||
$this->assertSame('', $plural);
|
||||
}
|
||||
|
||||
public function testSingularizeEmptyString()
|
||||
{
|
||||
$singular = Inflector::singularize('');
|
||||
$this->assertSame('', $singular);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/deprecation-contracts": "^2.1",
|
||||
"symfony/string": "^5.1"
|
||||
"symfony/string": "~5.1.10|^5.2.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Inflector\\": "" },
|
||||
|
@ -305,6 +305,7 @@ final class EnglishInflector implements InflectorInterface
|
||||
* A list of words which should not be inflected, reversed.
|
||||
*/
|
||||
private static $uninflected = [
|
||||
'',
|
||||
'atad',
|
||||
'reed',
|
||||
'kcabdeef',
|
||||
|
@ -306,4 +306,16 @@ class EnglishInflectorTest extends TestCase
|
||||
{
|
||||
$this->assertSame(\is_array($plural) ? $plural : [$plural], (new EnglishInflector())->pluralize($singular));
|
||||
}
|
||||
|
||||
public function testPluralizeEmptyString()
|
||||
{
|
||||
$plural = (new EnglishInflector())->pluralize('');
|
||||
$this->assertSame([''], $plural);
|
||||
}
|
||||
|
||||
public function testSingularizeEmptyString()
|
||||
{
|
||||
$singular = (new EnglishInflector())->singularize('');
|
||||
$this->assertSame([''], $singular);
|
||||
}
|
||||
}
|
||||
|
@ -761,10 +761,10 @@ class Parser
|
||||
switch ($value[0] ?? '') {
|
||||
case '"':
|
||||
case "'":
|
||||
$cursor = \strlen($this->currentLine) - \strlen($value);
|
||||
$cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value));
|
||||
$parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs);
|
||||
|
||||
if (isset($this->currentLine[$cursor]) && preg_replace('/\s*#.*$/A', '', substr($this->currentLine, $cursor))) {
|
||||
if (isset($this->currentLine[$cursor]) && preg_replace('/\s*(#.*)?$/A', '', substr($this->currentLine, $cursor))) {
|
||||
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($this->currentLine, $cursor)));
|
||||
}
|
||||
|
||||
|
@ -2670,7 +2670,7 @@ YAML;
|
||||
);
|
||||
}
|
||||
|
||||
public function testMultipleWhitespaceAtEndOfLine()
|
||||
public function testWhitespaceAtEndOfLine()
|
||||
{
|
||||
$yaml = "\nfoo:\n arguments: [ '@bar' ] \n";
|
||||
$this->assertSame(
|
||||
@ -2691,6 +2691,14 @@ YAML;
|
||||
],
|
||||
$this->parser->parse($yaml)
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
[
|
||||
'foo' => 'bar',
|
||||
'foobar' => 'baz',
|
||||
],
|
||||
$this->parser->parse("foo: 'bar' \nfoobar: baz")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user