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

Commitf4d0372

Browse files
Merge branch '6.0' into 6.1
* 6.0: [VarDumper] fix tests on PHP 8.2 [Mime] Add null check for EmailHeaderSame Add approriate description to CollectionToArrayTransformer::reverseTransform docblock [PropertyInfo] CS fixes [VarDumper] fix test on PHP 8.2 [Config] Fix looking for single files in phars with GlobResource Revert "bug#46327 [HttpKernel] Allow ErrorHandler ^5.0 to be used in HttpKernel 4.4 (mpdude)"
2 parents9fafd82 +25bba6b commitf4d0372

File tree

14 files changed

+103
-16
lines changed

14 files changed

+103
-16
lines changed

‎src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public function transform(mixed $collection): mixed
4646
}
4747

4848
/**
49-
* Transforms choice keys into entities.
50-
*
51-
* @param mixed $array An array of entities
49+
* Transforms an array into a collection.
5250
*/
5351
publicfunctionreverseTransform(mixed$array):Collection
5452
{

‎src/Symfony/Component/Config/Resource/GlobResource.php‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ public function getIterator(): \Traversable
106106
$prefix =str_replace('\\','/',$this->prefix);
107107
$paths =null;
108108

109-
if (!str_starts_with($this->prefix,'phar://') && !str_contains($this->pattern,'/**/')) {
109+
if ('' ===$this->pattern &&is_file($prefix)) {
110+
$paths = [$this->prefix];
111+
}elseif (!str_starts_with($this->prefix,'phar://') && !str_contains($this->pattern,'/**/')) {
110112
if ($this->globBrace || !str_contains($this->pattern,'{')) {
111113
$paths =glob($this->prefix.$this->pattern, \GLOB_NOSORT |$this->globBrace);
112114
}elseif (!str_contains($this->pattern,'\\') || !preg_match('/\\\\[,{}]/',$this->pattern)) {
@@ -167,12 +169,19 @@ function (\SplFileInfo $file, $path) {
167169
thrownew \LogicException(sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.',$this->pattern));
168170
}
169171

170-
$regex = Glob::toRegex($this->pattern);
172+
if (is_file($prefix =$this->prefix)) {
173+
$prefix =\dirname($prefix);
174+
$pattern =basename($prefix).$this->pattern;
175+
}else {
176+
$pattern =$this->pattern;
177+
}
178+
179+
$regex = Glob::toRegex($pattern);
171180
if ($this->recursive) {
172181
$regex =substr_replace($regex,'(/|$)', -2,1);
173182
}
174183

175-
$prefixLen =\strlen($this->prefix);
184+
$prefixLen =\strlen($prefix);
176185

177186
yieldfrom (newFinder())
178187
->followLinks()
@@ -190,7 +199,7 @@ function (\SplFileInfo $file, $path) {
190199
}
191200
})
192201
->sortByName()
193-
->in($this->prefix)
202+
->in($prefix)
194203
;
195204
}
196205

1.16 KB
Binary file not shown.

‎src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,29 @@ public function testSerializeUnserialize()
205205

206206
$this->assertEquals($p->getValue($resource),$p->getValue($newResource));
207207
}
208+
209+
publicfunctiontestPhar()
210+
{
211+
$s = \DIRECTORY_SEPARATOR;
212+
$cwd =getcwd();
213+
chdir(\dirname(__DIR__).'/Fixtures');
214+
try {
215+
$resource =newGlobResource('phar://some.phar','*',true);
216+
$files =array_keys(iterator_to_array($resource));
217+
$this->assertSame(["phar://some.phar{$s}ProjectWithXsdExtensionInPhar.php","phar://some.phar{$s}schema{$s}project-1.0.xsd"],$files);
218+
219+
$resource =newGlobResource("phar://some.phar{$s}ProjectWithXsdExtensionInPhar.php",'',true);
220+
$files =array_keys(iterator_to_array($resource));
221+
$this->assertSame(["phar://some.phar{$s}ProjectWithXsdExtensionInPhar.php"],$files);
222+
}finally {
223+
chdir($cwd);
224+
}
225+
}
226+
227+
publicfunctiontestFilePrefix()
228+
{
229+
$resource =newGlobResource(__FILE__,'/**/',true);
230+
$files =array_keys(iterator_to_array($resource));
231+
$this->assertSame([],$files);
232+
}
208233
}

‎src/Symfony/Component/Mime/Test/Constraint/EmailHeaderSame.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ protected function matches($message): bool
5555
*/
5656
protectedfunctionfailureDescription($message):string
5757
{
58-
returnsprintf('the Email %s (value is %s)',$this->toString(),$this->getHeaderValue($message));
58+
returnsprintf('the Email %s (value is %s)',$this->toString(),$this->getHeaderValue($message) ??'null');
5959
}
6060

61-
privatefunctiongetHeaderValue($message):string
61+
privatefunctiongetHeaderValue($message):?string
6262
{
63-
$header =$message->getHeaders()->get($this->headerName);
63+
if (null ===$header =$message->getHeaders()->get($this->headerName)) {
64+
returnnull;
65+
}
6466

6567
return$headerinstanceof UnstructuredHeader ?$header->getValue() :$header->getBodyAsString();
6668
}

‎src/Symfony/Component/Mime/Tests/EmailTest.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespaceSymfony\Component\Mime\Tests;
1313

14+
usePHPUnit\Framework\ExpectationFailedException;
1415
usePHPUnit\Framework\TestCase;
1516
useSymfony\Component\Mime\Address;
1617
useSymfony\Component\Mime\Email;
@@ -19,6 +20,7 @@
1920
useSymfony\Component\Mime\Part\Multipart\MixedPart;
2021
useSymfony\Component\Mime\Part\Multipart\RelatedPart;
2122
useSymfony\Component\Mime\Part\TextPart;
23+
useSymfony\Component\Mime\Test\Constraint\EmailHeaderSame;
2224
useSymfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
2325
useSymfony\Component\Serializer\Encoder\JsonEncoder;
2426
useSymfony\Component\Serializer\Normalizer\ArrayDenormalizer;
@@ -466,4 +468,14 @@ public function testSymfonySerialize()
466468
$this->assertEquals($expected->getHeaders(),$n->getHeaders());
467469
$this->assertEquals($expected->getBody(),$n->getBody());
468470
}
471+
472+
publicfunctiontestMissingHeaderDoesNotThrowError()
473+
{
474+
$this->expectException(ExpectationFailedException::class);
475+
$this->expectExceptionMessage('Failed asserting that the Email has header "foo" with value "bar" (value is null).');
476+
477+
$e =newEmail();
478+
$emailHeaderSame =newEmailHeaderSame('foo','bar');
479+
$emailHeaderSame->evaluate($e);
480+
}
469481
}

‎src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespaceSymfony\Component\PropertyInfo\Tests\Fixtures;
413

514
/**

‎src/Symfony/Component/PropertyInfo/Tests/Fixtures/DockBlockFallback.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
namespaceSymfony\Component\PropertyInfo\Tests\Fixtures;
4-
53
/*
64
* This file is part of the Symfony package.
75
*

‎src/Symfony/Component/PropertyInfo/Tests/Fixtures/Extractor/DummyNamespace.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespaceA {
413
class Property {
514

‎src/Symfony/Component/PropertyInfo/Tests/Fixtures/NoProperties.php‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
namespaceSymfony\Component\PropertyInfo\Tests\Fixtures;
4-
53
/*
64
* This file is part of the Symfony package.
75
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp