Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd12afe

Browse files
committed
Merge branch '5.3' into 5.4
2 parents6aa60fa +858bc28 commitcd12afe

File tree

19 files changed

+82
-57
lines changed

19 files changed

+82
-57
lines changed

‎src/Symfony/Component/Config/Definition/ArrayNode.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getDefaultValue()
184184
publicfunctionaddChild(NodeInterface$node)
185185
{
186186
$name =$node->getName();
187-
if (!\strlen($name)) {
187+
if ('' ===$name) {
188188
thrownew \InvalidArgumentException('Child nodes must be named.');
189189
}
190190
if (isset($this->children[$name])) {

‎src/Symfony/Component/Console/Helper/QuestionHelper.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private function mostRecentlyEnteredValue(string $entered): string
379379
}
380380

381381
$choices =explode(',',$entered);
382-
if (\strlen($lastChoice =trim($choices[\count($choices) -1])) >0) {
382+
if ('' !==$lastChoice =trim($choices[\count($choices) -1])) {
383383
return$lastChoice;
384384
}
385385

‎src/Symfony/Component/Console/Input/StringInput.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ private function tokenize(string $input): array
5050
while ($cursor <$length) {
5151
if (preg_match('/\s+/A',$input,$match,0,$cursor)) {
5252
}elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A',$input,$match,0,$cursor)) {
53-
$tokens[] =$match[1].$match[2].stripcslashes(str_replace(['"\'','\'"','\'\'','""'],'',substr($match[3],1,\strlen($match[3]) -2)));
53+
$tokens[] =$match[1].$match[2].stripcslashes(str_replace(['"\'','\'"','\'\'','""'],'',substr($match[3],1,-1)));
5454
}elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A',$input,$match,0,$cursor)) {
55-
$tokens[] =stripcslashes(substr($match[0],1,\strlen($match[0]) -2));
55+
$tokens[] =stripcslashes(substr($match[0],1,-1));
5656
}elseif (preg_match('/'.self::REGEX_STRING.'/A',$input,$match,0,$cursor)) {
5757
$tokens[] =stripcslashes($match[1]);
5858
}else {

‎src/Symfony/Component/Filesystem/Filesystem.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ public function appendToFile(string $filename, $content)
714714

715715
privatefunctiontoIterable($files):iterable
716716
{
717-
return\is_array($files) ||$filesinstanceof \Traversable ?$files : [$files];
717+
returnis_iterable($files) ?$files : [$files];
718718
}
719719

720720
/**

‎src/Symfony/Component/Finder/Finder.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ public function append(iterable $iterator)
654654
$this->iterators[] =$iterator->getIterator();
655655
}elseif ($iteratorinstanceof \Iterator) {
656656
$this->iterators[] =$iterator;
657-
}elseif ($iteratorinstanceof \Traversable ||\is_array($iterator)) {
657+
}elseif (is_iterable($iterator)) {
658658
$it =new \ArrayIterator();
659659
foreach ($iteratoras$file) {
660660
$file =$fileinstanceof \SplFileInfo ?$file :new \SplFileInfo($file);

‎src/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php‎

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ class ComparatorTest extends TestCase
1818
{
1919
publicfunctiontestGetSetOperator()
2020
{
21-
$comparator =newComparator();
22-
try {
23-
$comparator->setOperator('foo');
24-
$this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
25-
}catch (\Exception$e) {
26-
$this->assertInstanceOf(\InvalidArgumentException::class,$e,'->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
27-
}
28-
2921
$comparator =newComparator();
3022
$comparator->setOperator('>');
3123
$this->assertEquals('>',$comparator->getOperator(),'->getOperator() returns the current operator');
3224
}
3325

26+
publicfunctiontestInvalidOperator()
27+
{
28+
$comparator =newComparator();
29+
30+
$this->expectException(\InvalidArgumentException::class);
31+
$this->expectExceptionMessage('Invalid operator "foo".');
32+
$comparator->setOperator('foo');
33+
}
34+
3435
publicfunctiontestGetSetTarget()
3536
{
3637
$comparator =newComparator();
@@ -39,27 +40,55 @@ public function testGetSetTarget()
3940
}
4041

4142
/**
42-
* @dataProvidergetTestData
43+
* @dataProviderprovideMatches
4344
*/
44-
publicfunctiontestTest($operator,$target,$match,$noMatch)
45+
publicfunctiontestTestSucceeds(string$operator,string$target,string$testedValue)
4546
{
4647
$c =newComparator();
4748
$c->setOperator($operator);
4849
$c->setTarget($target);
4950

50-
foreach ($matchas$m) {
51-
$this->assertTrue($c->test($m),'->test() tests a string against the expression');
52-
}
51+
$this->assertTrue($c->test($testedValue));
52+
}
53+
54+
publicfunctionprovideMatches():array
55+
{
56+
return [
57+
['<','1000','500'],
58+
['<','1000','999'],
59+
['<=','1000','999'],
60+
['!=','1000','999'],
61+
['<=','1000','1000'],
62+
['==','1000','1000'],
63+
['>=','1000','1000'],
64+
['>=','1000','1001'],
65+
['>','1000','1001'],
66+
['>','1000','5000'],
67+
];
68+
}
69+
70+
/**
71+
* @dataProvider provideNonMatches
72+
*/
73+
publicfunctiontestTestFails(string$operator,string$target,string$testedValue)
74+
{
75+
$c =newComparator();
76+
$c->setOperator($operator);
77+
$c->setTarget($target);
5378

54-
foreach ($noMatchas$m) {
55-
$this->assertFalse($c->test($m),'->test() tests a string against the expression');
56-
}
79+
$this->assertFalse($c->test($testedValue));
5780
}
5881

59-
publicfunctiongetTestData()
82+
publicfunctionprovideNonMatches():array
6083
{
6184
return [
62-
['<','1000', ['500','999'], ['1000','1500']],
85+
['>','1000','500'],
86+
['>=','1000','500'],
87+
['>','1000','1000'],
88+
['!=','1000','1000'],
89+
['<','1000','1000'],
90+
['<','1000','1500'],
91+
['<=','1000','1500'],
6392
];
6493
}
6594
}

‎src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ public function getDecoratedFactory()
8484
/**
8585
* {@inheritdoc}
8686
*
87-
* @param callable|Cache\ChoiceValue|null $value The callable or static option for
88-
* generating the choice values
89-
* @param callable|Cache\ChoiceFilter|null $filter The callable or static option for
90-
* filtering the choices
87+
* @param mixed $value
88+
* @param mixed $filter
9189
*/
9290
publicfunctioncreateListFromChoices(iterable$choices,$value =null/*, $filter = null*/)
9391
{
@@ -127,12 +125,8 @@ public function createListFromChoices(iterable $choices, $value = null/*, $filte
127125
/**
128126
* {@inheritdoc}
129127
*
130-
* @param ChoiceLoaderInterface|Cache\ChoiceLoader $loader The loader or static loader to load
131-
* the choices lazily
132-
* @param callable|Cache\ChoiceValue|null $value The callable or static option for
133-
* generating the choice values
134-
* @param callable|Cache\ChoiceFilter|null $filter The callable or static option for
135-
* filtering the choices
128+
* @param mixed $value
129+
* @param mixed $filter
136130
*/
137131
publicfunctioncreateListFromLoader(ChoiceLoaderInterface$loader,$value =null/*, $filter = null*/)
138132
{
@@ -174,12 +168,12 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
174168
/**
175169
* {@inheritdoc}
176170
*
177-
* @paramarray|callable|Cache\PreferredChoice|null$preferredChoices The preferred choices
178-
* @paramcallable|false|Cache\ChoiceLabel|null$label The option or static option generating the choice labels
179-
* @paramcallable|Cache\ChoiceFieldName|null$index The option or static option generating the view indices
180-
* @paramcallable|Cache\GroupBy|null$groupBy The option or static option generating the group names
181-
* @paramarray|callable|Cache\ChoiceAttr|null$attr The option or static option generating the HTML attributes
182-
* @paramarray|callable|Cache\ChoiceTranslationParameters $labelTranslationParameters The parameters used to translate the choice labels
171+
* @parammixed$preferredChoices
172+
* @parammixed$label
173+
* @parammixed$index
174+
* @parammixed$groupBy
175+
* @parammixed$attr
176+
* @parammixed $labelTranslationParameters
183177
*/
184178
publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null/*, $labelTranslationParameters = []*/)
185179
{

‎src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
useSymfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
1919
useSymfony\Component\PropertyAccess\PropertyAccess;
2020
useSymfony\Component\PropertyAccess\PropertyAccessorInterface;
21+
useSymfony\Component\PropertyAccess\PropertyPathInterface;
2122

2223
/**
2324
* Writes and reads values to/from an object or array using property path.
@@ -84,7 +85,7 @@ public function isWritable($data, FormInterface $form): bool
8485
returnnull !==$form->getPropertyPath();
8586
}
8687

87-
privatefunctiongetPropertyValue($data,$propertyPath)
88+
privatefunctiongetPropertyValue($data,PropertyPathInterface$propertyPath)
8889
{
8990
try {
9091
return$this->propertyAccessor->getValue($data,$propertyPath);

‎src/Symfony/Component/Form/Tests/VersionAwareTest.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ trait VersionAwareTest
1515
{
1616
protectedstatic$supportedFeatureSetVersion =404;
1717

18-
/**
19-
* @param int $requiredFeatureSetVersion
20-
*/
21-
protectedfunctionrequiresFeatureSet($requiredFeatureSetVersion)
18+
protectedfunctionrequiresFeatureSet(int$requiredFeatureSetVersion)
2219
{
2320
if ($requiredFeatureSetVersion >static::$supportedFeatureSetVersion) {
2421
$this->markTestSkipped(sprintf('Test requires features from symfony/form %.2f but only version %.2f is supported.',$requiredFeatureSetVersion /100,static::$supportedFeatureSetVersion /100));

‎src/Symfony/Component/Mime/Header/AbstractHeader.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ protected function getEncodableWordTokens(string $string): array
164164
if ($this->tokenNeedsEncoding($token)) {
165165
$encodedToken .=$token;
166166
}else {
167-
if (\strlen($encodedToken) >0) {
167+
if ('' !==$encodedToken) {
168168
$tokens[] =$encodedToken;
169169
$encodedToken ='';
170170
}
171171
$tokens[] =$token;
172172
}
173173
}
174-
if (\strlen($encodedToken)) {
174+
if ('' !==$encodedToken) {
175175
$tokens[] =$encodedToken;
176176
}
177177

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp