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

Commit3e869d0

Browse files
authored
Merge branch '6.2' into form-validate-events
2 parents22248d7 +b7ce8f2 commit3e869d0

File tree

1,426 files changed

+13116
-9836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,426 files changed

+13116
-9836
lines changed

‎.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'protected_to_private' =>false,
3232
'native_constant_invocation' => ['strict' =>false],
3333
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' =>false],
34+
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' =>true],
3435
'header_comment' => ['header' =>$fileHeaderComment],
3536
'modernize_strpos' =>true,
3637
])

‎UPGRADE-6.2.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ HttpFoundation
1414

1515
* Deprecate`Request::getContentType()`, use`Request::getContentTypeFormat()` instead
1616

17+
HttpKernel
18+
----------
19+
20+
* Deprecate`ArgumentValueResolverInterface`, use`ValueResolverInterface` instead
21+
1722
Ldap
1823
----
1924

@@ -37,3 +42,13 @@ Validator
3742
---------
3843

3944
* Deprecate the`loose` e-mail validation mode, use`html5` instead
45+
46+
Workflow
47+
--------
48+
49+
* The`Registry` is marked as internal and should not be used directly. use a tagged locator instead
50+
```
51+
tagged_locator('workflow', 'name')
52+
```
53+
* The first argument of `WorkflowDumpCommand` should be a `ServiceLocator` of
54+
all workflows indexed by names

‎UPGRADE-7.0.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPGRADE FROM 6.4 to 7.0
2+
=======================
3+
4+
Workflow
5+
--------
6+
7+
* The first argument of`WorkflowDumpCommand` must be a`ServiceLocator` of all
8+
workflows indexed by names

‎composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,23 @@
126126
"doctrine/data-fixtures":"^1.1",
127127
"doctrine/dbal":"^2.13.1|^3.0",
128128
"doctrine/orm":"^2.7.4",
129+
"egulias/email-validator":"^2.1.10|^3.1",
129130
"guzzlehttp/promises":"^1.4",
131+
"league/html-to-markdown":"^5.0",
130132
"masterminds/html5":"^2.7.2",
131133
"monolog/monolog":"^1.25.1|^2",
132134
"nyholm/psr7":"^1.0",
133135
"pda/pheanstalk":"^4.0",
134136
"php-http/httplug":"^1.0|^2.0",
137+
"phpdocumentor/reflection-docblock":"^5.2",
135138
"phpstan/phpdoc-parser":"^1.0",
136139
"predis/predis":"~1.1",
137140
"psr/http-client":"^1.0",
138141
"psr/simple-cache":"^1.0|^2.0|^3.0",
139-
"egulias/email-validator":"^2.1.10|^3.1",
140142
"symfony/mercure-bundle":"^0.3",
141143
"symfony/phpunit-bridge":"^5.4|^6.0",
142144
"symfony/runtime":"self.version",
143145
"symfony/security-acl":"~2.8|~3.0",
144-
"phpdocumentor/reflection-docblock":"^5.2",
145146
"twig/cssinliner-extra":"^2.12|^3",
146147
"twig/inky-extra":"^2.12|^3",
147148
"twig/markdown-extra":"^2.12|^3"

‎psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@
4343
</errorLevel>
4444
</UndefinedAttributeClass>
4545
</issueHandlers>
46+
47+
<forbiddenFunctions>
48+
<functionname="empty"/>
49+
</forbiddenFunctions>
4650
</psalm>

‎src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

Lines changed: 45 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
useSymfony\Bridge\Doctrine\Attribute\MapEntity;
2020
useSymfony\Component\ExpressionLanguage\ExpressionLanguage;
2121
useSymfony\Component\HttpFoundation\Request;
22-
useSymfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
22+
useSymfony\Component\HttpKernel\Controller\ValueResolverInterface;
2323
useSymfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2424
useSymfony\Component\HttpKernel\Exception\NotFoundHttpException;
2525

@@ -29,7 +29,7 @@
2929
* @author Fabien Potencier <fabien@symfony.com>
3030
* @author Jérémy Derussé <jeremy@derusse.com>
3131
*/
32-
finalclass EntityValueResolverimplementsArgumentValueResolverInterface
32+
finalclass EntityValueResolverimplementsValueResolverInterface
3333
{
3434
publicfunction__construct(
3535
privateManagerRegistry$registry,
@@ -38,61 +38,36 @@ public function __construct(
3838
) {
3939
}
4040

41-
/**
42-
* {@inheritdoc}
43-
*/
44-
publicfunctionsupports(Request$request,ArgumentMetadata$argument):bool
41+
publicfunctionresolve(Request$request,ArgumentMetadata$argument):array
4542
{
46-
if (!$this->registry->getManagerNames()) {
47-
returnfalse;
48-
}
49-
50-
$options =$this->getOptions($argument);
43+
$options =$this->getMapEntityAttribute($argument);
5144
if (!$options->class ||$options->disabled) {
52-
returnfalse;
45+
return[];
5346
}
54-
55-
// Doctrine Entity?
56-
if (!$objectManager =$this->getManager($options->objectManager,$options->class)) {
57-
returnfalse;
47+
if (!$manager =$this->getManager($options->objectManager,$options->class)) {
48+
return [];
5849
}
5950

60-
return !$objectManager->getMetadataFactory()->isTransient($options->class);
61-
}
62-
63-
/**
64-
* {@inheritdoc}
65-
*/
66-
publicfunctionresolve(Request$request,ArgumentMetadata$argument):iterable
67-
{
68-
$options =$this->getOptions($argument);
69-
$name =$argument->getName();
70-
$class =$options->class;
71-
72-
$errorMessage =null;
51+
$message ='';
7352
if (null !==$options->expr) {
74-
if (null ===$object =$this->findViaExpression($class,$request,$options->expr,$options)) {
75-
$errorMessage =sprintf('The expression "%s" returned null',$options->expr);
53+
if (null ===$object =$this->findViaExpression($manager,$request,$options)) {
54+
$message =sprintf('The expression "%s" returned null.',$options->expr);
7655
}
77-
// find by identifier?
78-
}elseif (false ===$object =$this->find($class,$request,$options,$name)) {
56+
// find by identifier?
57+
}elseif (false ===$object =$this->find($manager,$request,$options,$argument->getName())) {
7958
// find by criteria
80-
if (false ===$object =$this->findOneBy($class,$request,$options)) {
81-
if (!$argument->isNullable()) {
82-
thrownew \LogicException(sprintf('Unable to guess how to get a Doctrine instance from the request information for parameter "%s".',$name));
83-
}
84-
59+
if (!$criteria =$this->getCriteria($request,$options,$manager)) {
60+
return [];
61+
}
62+
try {
63+
$object =$manager->getRepository($options->class)->findOneBy($criteria);
64+
}catch (NoResultException|ConversionException) {
8565
$object =null;
8666
}
8767
}
8868

8969
if (null ===$object && !$argument->isNullable()) {
90-
$message =sprintf('"%s" object not found by the "%s" Argument Resolver.',$class,self::class);
91-
if ($errorMessage) {
92-
$message .=''.$errorMessage;
93-
}
94-
95-
thrownewNotFoundHttpException($message);
70+
thrownewNotFoundHttpException(sprintf('"%s" object not found by "%s".',$options->class,self::class).$message);
9671
}
9772

9873
return [$object];
@@ -104,38 +79,35 @@ private function getManager(?string $name, string $class): ?ObjectManager
10479
return$this->registry->getManagerForClass($class);
10580
}
10681

107-
if (!isset($this->registry->getManagerNames()[$name])) {
108-
returnnull;
109-
}
110-
11182
try {
112-
return$this->registry->getManager($name);
83+
$manager =$this->registry->getManager($name);
11384
}catch (\InvalidArgumentException) {
11485
returnnull;
11586
}
87+
88+
return$manager->getMetadataFactory()->isTransient($class) ?null :$manager;
11689
}
11790

118-
privatefunctionfind(string$class,Request$request,MapEntity$options,string$name):false|object|null
91+
privatefunctionfind(ObjectManager$manager,Request$request,MapEntity$options,string$name):false|object|null
11992
{
12093
if ($options->mapping ||$options->exclude) {
12194
returnfalse;
12295
}
12396

12497
$id =$this->getIdentifier($request,$options,$name);
12598
if (false ===$id ||null ===$id) {
126-
returnfalse;
99+
return$id;
127100
}
128101

129-
$objectManager =$this->getManager($options->objectManager,$class);
130-
if ($options->evictCache &&$objectManagerinstanceof EntityManagerInterface) {
131-
$cacheProvider =$objectManager->getCache();
132-
if ($cacheProvider &&$cacheProvider->containsEntity($class,$id)) {
133-
$cacheProvider->evictEntity($class,$id);
102+
if ($options->evictCache &&$managerinstanceof EntityManagerInterface) {
103+
$cacheProvider =$manager->getCache();
104+
if ($cacheProvider &&$cacheProvider->containsEntity($options->class,$id)) {
105+
$cacheProvider->evictEntity($options->class,$id);
134106
}
135107
}
136108

137109
try {
138-
return$objectManager->getRepository($class)->find($id);
110+
return$manager->getRepository($options->class)->find($id);
139111
}catch (NoResultException|ConversionException) {
140112
returnnull;
141113
}
@@ -162,40 +134,42 @@ private function getIdentifier(Request $request, MapEntity $options, string $nam
162134
}
163135

164136
if ($request->attributes->has($name)) {
165-
return$request->attributes->get($name);
137+
return$request->attributes->get($name) ?? ($options->stripNull ?false :null);
166138
}
167139

168140
if (!$options->id &&$request->attributes->has('id')) {
169-
return$request->attributes->get('id');
141+
return$request->attributes->get('id') ?? ($options->stripNull ?false :null);
170142
}
171143

172144
returnfalse;
173145
}
174146

175-
privatefunctionfindOneBy(string$class,Request$request,MapEntity$options):false|object|null
147+
privatefunctiongetCriteria(Request$request,MapEntity$options,ObjectManager$manager):array
176148
{
177149
if (null ===$mapping =$options->mapping) {
178-
$keys =$request->attributes->keys();
179-
$mapping =$keys ?array_combine($keys,$keys) : [];
150+
$mapping =$request->attributes->keys();
151+
}
152+
153+
if ($mapping &&\is_array($mapping) &&array_is_list($mapping)) {
154+
$mapping =array_combine($mapping,$mapping);
180155
}
181156

182157
foreach ($options->excludeas$exclude) {
183158
unset($mapping[$exclude]);
184159
}
185160

186161
if (!$mapping) {
187-
returnfalse;
162+
return[];
188163
}
189164

190165
// if a specific id has been defined in the options and there is no corresponding attribute
191166
// return false in order to avoid a fallback to the id which might be of another object
192167
if (\is_string($options->id) &&null ===$request->attributes->get($options->id)) {
193-
returnfalse;
168+
return[];
194169
}
195170

196171
$criteria = [];
197-
$objectManager =$this->getManager($options->objectManager,$class);
198-
$metadata =$objectManager->getClassMetadata($class);
172+
$metadata =$manager->getClassMetadata($options->class);
199173

200174
foreach ($mappingas$attribute =>$field) {
201175
if (!$metadata->hasField($field) && (!$metadata->hasAssociation($field) || !$metadata->isSingleValuedAssociation($field))) {
@@ -209,34 +183,26 @@ private function findOneBy(string $class, Request $request, MapEntity $options):
209183
$criteria =array_filter($criteria,staticfn ($value) =>null !==$value);
210184
}
211185

212-
if (!$criteria) {
213-
returnfalse;
214-
}
215-
216-
try {
217-
return$objectManager->getRepository($class)->findOneBy($criteria);
218-
}catch (NoResultException|ConversionException) {
219-
returnnull;
220-
}
186+
return$criteria;
221187
}
222188

223-
privatefunctionfindViaExpression(string$class,Request$request,string$expression,MapEntity$options): ?object
189+
privatefunctionfindViaExpression(ObjectManager$manager,Request$request,MapEntity$options): ?object
224190
{
225191
if (!$this->expressionLanguage) {
226192
thrownew \LogicException(sprintf('You cannot use the "%s" if the ExpressionLanguage component is not available. Try running "composer require symfony/expression-language".',__CLASS__));
227193
}
228194

229-
$repository =$this->getManager($options->objectManager,$class)->getRepository($class);
195+
$repository =$manager->getRepository($options->class);
230196
$variables =array_merge($request->attributes->all(), ['repository' =>$repository]);
231197

232198
try {
233-
return$this->expressionLanguage->evaluate($expression,$variables);
199+
return$this->expressionLanguage->evaluate($options->expr,$variables);
234200
}catch (NoResultException|ConversionException) {
235201
returnnull;
236202
}
237203
}
238204

239-
privatefunctiongetOptions(ArgumentMetadata$argument):MapEntity
205+
privatefunctiongetMapEntityAttribute(ArgumentMetadata$argument):MapEntity
240206
{
241207
/** @var MapEntity $options */
242208
$options =$argument->getAttributes(MapEntity::class, ArgumentMetadata::IS_INSTANCEOF)[0] ??$this->defaults;

‎src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public function isOptional(): bool
4040
}
4141

4242
/**
43-
* {@inheritdoc}
44-
*
4543
* @return string[] A list of files to preload on PHP 7.4+
4644
*/
4745
publicfunctionwarmUp(string$cacheDir):array

‎src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public function __construct(ContainerInterface $container, array $subscriberIds
4444
$this->subscribers =$subscriberIds;
4545
}
4646

47-
/**
48-
* {@inheritdoc}
49-
*/
5047
publicfunctiondispatchEvent($eventName,EventArgs$eventArgs =null):void
5148
{
5249
if (!$this->initializedSubscribers) {
@@ -68,8 +65,6 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null): void
6865
}
6966

7067
/**
71-
* {@inheritdoc}
72-
*
7368
* @return object[][]
7469
*/
7570
publicfunctiongetListeners($event =null):array
@@ -94,9 +89,6 @@ public function getListeners($event = null): array
9489
return$this->listeners;
9590
}
9691

97-
/**
98-
* {@inheritdoc}
99-
*/
10092
publicfunctionhasListeners($event):bool
10193
{
10294
if (!$this->initializedSubscribers) {
@@ -106,9 +98,6 @@ public function hasListeners($event): bool
10698
returnisset($this->listeners[$event]) &&$this->listeners[$event];
10799
}
108100

109-
/**
110-
* {@inheritdoc}
111-
*/
112101
publicfunctionaddEventListener($events,$listener):void
113102
{
114103
if (!$this->initializedSubscribers) {
@@ -130,9 +119,6 @@ public function addEventListener($events, $listener): void
130119
}
131120
}
132121

133-
/**
134-
* {@inheritdoc}
135-
*/
136122
publicfunctionremoveEventListener($events,$listener):void
137123
{
138124
if (!$this->initializedSubscribers) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp