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

Appearance settings

Commit 3955d39

Browse filesBrowse files
committed
Merge branch '5.3' into 5.4
* 5.3: Fix amqp-messenger integration test [Console] Run commands when implements SignalableCommandInterface without pcntl and they have'nt signals [Form] Fix 'invalid_message' use in multiple ChoiceType [Form] fix some type annotations
2 parents d46125a + 298e450 commit 3955d39
Copy full SHA for 3955d39

File tree

10 files changed

+58
-85
lines changed
Filter options

10 files changed

+58
-85
lines changed

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
947947
}
948948
}
949949

950-
if ($command instanceof SignalableCommandInterface) {
950+
if ($command instanceof SignalableCommandInterface && ($this->signalsToDispatchEvent || $command->getSubscribedSignals())) {
951951
if (!$this->signalRegistry) {
952952
throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
953953
}

‎src/Symfony/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use Symfony\Component\Console\Output\Output;
3838
use Symfony\Component\Console\Output\OutputInterface;
3939
use Symfony\Component\Console\Output\StreamOutput;
40+
use Symfony\Component\Console\SignalRegistry\SignalRegistry;
4041
use Symfony\Component\Console\Tester\ApplicationTester;
4142
use Symfony\Component\DependencyInjection\ContainerBuilder;
4243
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -1863,6 +1864,18 @@ public function testSignal()
18631864
$this->assertTrue($command->signaled);
18641865
$this->assertTrue($dispatcherCalled);
18651866
}
1867+
1868+
public function testSignalableCommandInterfaceWithoutSignals()
1869+
{
1870+
$command = new SignableCommand();
1871+
1872+
$dispatcher = new EventDispatcher();
1873+
$application = new Application();
1874+
$application->setAutoExit(false);
1875+
$application->setDispatcher($dispatcher);
1876+
$application->add($command);
1877+
$this->assertSame(0, $application->run(new ArrayInput(['signal'])));
1878+
}
18661879
}
18671880

18681881
class CustomApplication extends Application
@@ -1930,7 +1943,7 @@ class SignableCommand extends Command implements SignalableCommandInterface
19301943

19311944
public function getSubscribedSignals(): array
19321945
{
1933-
return [\SIGALRM];
1946+
return SignalRegistry::isSupported() ? [\SIGALRM] : [];
19341947
}
19351948

19361949
public function handleSignal(int $signal): void

‎src/Symfony/Component/Form/Button.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Button.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ public function handleRequest($request = null)
365365
/**
366366
* Submits data to the button.
367367
*
368-
* @param string|null $submittedData Not used
369-
* @param bool $clearMissing Not used
368+
* @param array|string|null $submittedData Not used
369+
* @param bool $clearMissing Not used
370370
*
371371
* @return $this
372372
*

‎src/Symfony/Component/Form/ButtonBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ButtonBuilder.php
-48Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ public function __construct(?string $name, array $options = [])
6767
/**
6868
* Unsupported method.
6969
*
70-
* This method should not be invoked.
71-
*
7270
* @throws BadMethodCallException
7371
*/
7472
public function add($child, string $type = null, array $options = [])
@@ -79,8 +77,6 @@ public function add($child, string $type = null, array $options = [])
7977
/**
8078
* Unsupported method.
8179
*
82-
* This method should not be invoked.
83-
*
8480
* @throws BadMethodCallException
8581
*/
8682
public function create(string $name, string $type = null, array $options = [])
@@ -91,8 +87,6 @@ public function create(string $name, string $type = null, array $options = [])
9187
/**
9288
* Unsupported method.
9389
*
94-
* This method should not be invoked.
95-
*
9690
* @throws BadMethodCallException
9791
*/
9892
public function get(string $name)
@@ -103,8 +97,6 @@ public function get(string $name)
10397
/**
10498
* Unsupported method.
10599
*
106-
* This method should not be invoked.
107-
*
108100
* @throws BadMethodCallException
109101
*/
110102
public function remove(string $name)
@@ -145,8 +137,6 @@ public function getForm()
145137
/**
146138
* Unsupported method.
147139
*
148-
* This method should not be invoked.
149-
*
150140
* @throws BadMethodCallException
151141
*/
152142
public function addEventListener(string $eventName, callable $listener, int $priority = 0)
@@ -157,8 +147,6 @@ public function addEventListener(string $eventName, callable $listener, int $pri
157147
/**
158148
* Unsupported method.
159149
*
160-
* This method should not be invoked.
161-
*
162150
* @throws BadMethodCallException
163151
*/
164152
public function addEventSubscriber(EventSubscriberInterface $subscriber)
@@ -169,8 +157,6 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber)
169157
/**
170158
* Unsupported method.
171159
*
172-
* This method should not be invoked.
173-
*
174160
* @throws BadMethodCallException
175161
*/
176162
public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false)
@@ -181,8 +167,6 @@ public function addViewTransformer(DataTransformerInterface $viewTransformer, bo
181167
/**
182168
* Unsupported method.
183169
*
184-
* This method should not be invoked.
185-
*
186170
* @throws BadMethodCallException
187171
*/
188172
public function resetViewTransformers()
@@ -193,8 +177,6 @@ public function resetViewTransformers()
193177
/**
194178
* Unsupported method.
195179
*
196-
* This method should not be invoked.
197-
*
198180
* @throws BadMethodCallException
199181
*/
200182
public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false)
@@ -205,8 +187,6 @@ public function addModelTransformer(DataTransformerInterface $modelTransformer,
205187
/**
206188
* Unsupported method.
207189
*
208-
* This method should not be invoked.
209-
*
210190
* @throws BadMethodCallException
211191
*/
212192
public function resetModelTransformers()
@@ -237,8 +217,6 @@ public function setAttributes(array $attributes)
237217
/**
238218
* Unsupported method.
239219
*
240-
* This method should not be invoked.
241-
*
242220
* @throws BadMethodCallException
243221
*/
244222
public function setDataMapper(DataMapperInterface $dataMapper = null)
@@ -261,10 +239,6 @@ public function setDisabled(bool $disabled)
261239
/**
262240
* Unsupported method.
263241
*
264-
* This method should not be invoked.
265-
*
266-
* @param mixed $emptyData
267-
*
268242
* @throws BadMethodCallException
269243
*/
270244
public function setEmptyData($emptyData)
@@ -275,8 +249,6 @@ public function setEmptyData($emptyData)
275249
/**
276250
* Unsupported method.
277251
*
278-
* This method should not be invoked.
279-
*
280252
* @throws BadMethodCallException
281253
*/
282254
public function setErrorBubbling(bool $errorBubbling)
@@ -287,8 +259,6 @@ public function setErrorBubbling(bool $errorBubbling)
287259
/**
288260
* Unsupported method.
289261
*
290-
* This method should not be invoked.
291-
*
292262
* @throws BadMethodCallException
293263
*/
294264
public function setRequired(bool $required)
@@ -299,10 +269,6 @@ public function setRequired(bool $required)
299269
/**
300270
* Unsupported method.
301271
*
302-
* This method should not be invoked.
303-
*
304-
* @param null $propertyPath
305-
*
306272
* @throws BadMethodCallException
307273
*/
308274
public function setPropertyPath($propertyPath)
@@ -313,8 +279,6 @@ public function setPropertyPath($propertyPath)
313279
/**
314280
* Unsupported method.
315281
*
316-
* This method should not be invoked.
317-
*
318282
* @throws BadMethodCallException
319283
*/
320284
public function setMapped(bool $mapped)
@@ -325,8 +289,6 @@ public function setMapped(bool $mapped)
325289
/**
326290
* Unsupported method.
327291
*
328-
* This method should not be invoked.
329-
*
330292
* @throws BadMethodCallException
331293
*/
332294
public function setByReference(bool $byReference)
@@ -337,8 +299,6 @@ public function setByReference(bool $byReference)
337299
/**
338300
* Unsupported method.
339301
*
340-
* This method should not be invoked.
341-
*
342302
* @throws BadMethodCallException
343303
*/
344304
public function setCompound(bool $compound)
@@ -361,10 +321,6 @@ public function setType(ResolvedFormTypeInterface $type)
361321
/**
362322
* Unsupported method.
363323
*
364-
* This method should not be invoked.
365-
*
366-
* @param mixed $data
367-
*
368324
* @throws BadMethodCallException
369325
*/
370326
public function setData($data)
@@ -375,8 +331,6 @@ public function setData($data)
375331
/**
376332
* Unsupported method.
377333
*
378-
* This method should not be invoked.
379-
*
380334
* @throws BadMethodCallException
381335
*/
382336
public function setDataLocked(bool $locked)
@@ -387,8 +341,6 @@ public function setDataLocked(bool $locked)
387341
/**
388342
* Unsupported method.
389343
*
390-
* This method should not be invoked.
391-
*
392344
* @throws BadMethodCallException
393345
*/
394346
public function setFormFactory(FormFactoryInterface $formFactory)

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
+21-24Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\PropertyAccess\PropertyAccess;
1919
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
2020
use Symfony\Component\PropertyAccess\PropertyPath;
21+
use Symfony\Component\PropertyAccess\PropertyPathInterface;
2122

2223
/**
2324
* Adds property path support to a choice list factory.
@@ -59,12 +60,10 @@ public function getDecoratedFactory()
5960
/**
6061
* {@inheritdoc}
6162
*
62-
* @param callable|string|PropertyPath|null $value The callable or path for
63-
* generating the choice values
64-
* @param callable|string|PropertyPath|null $filter The callable or path for
65-
* filtering the choices
63+
* @param mixed $value
64+
* @param mixed $filter
6665
*
67-
* @return ChoiceListInterface The choice list
66+
* @return ChoiceListInterface
6867
*/
6968
public function createListFromChoices(iterable $choices, $value = null/*, $filter = null*/)
7069
{
@@ -74,7 +73,7 @@ public function createListFromChoices(iterable $choices, $value = null/*, $filte
7473
$value = new PropertyPath($value);
7574
}
7675

77-
if ($value instanceof PropertyPath) {
76+
if ($value instanceof PropertyPathInterface) {
7877
$accessor = $this->propertyAccessor;
7978
$value = function ($choice) use ($accessor, $value) {
8079
// The callable may be invoked with a non-object/array value
@@ -102,12 +101,10 @@ public function createListFromChoices(iterable $choices, $value = null/*, $filte
102101
/**
103102
* {@inheritdoc}
104103
*
105-
* @param callable|string|PropertyPath|null $value The callable or path for
106-
* generating the choice values
107-
* @param callable|string|PropertyPath|null $filter The callable or path for
108-
* filtering the choices
104+
* @param mixed $value
105+
* @param mixed $filter
109106
*
110-
* @return ChoiceListInterface The choice list
107+
* @return ChoiceListInterface
111108
*/
112109
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null/*, $filter = null*/)
113110
{
@@ -117,7 +114,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
117114
$value = new PropertyPath($value);
118115
}
119116

120-
if ($value instanceof PropertyPath) {
117+
if ($value instanceof PropertyPathInterface) {
121118
$accessor = $this->propertyAccessor;
122119
$value = function ($choice) use ($accessor, $value) {
123120
// The callable may be invoked with a non-object/array value
@@ -145,14 +142,14 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
145142
/**
146143
* {@inheritdoc}
147144
*
148-
* @param array|callable|string|PropertyPath|null $preferredChoices The preferred choices
149-
* @param callable|string|PropertyPath|null $label The callable or path generating the choice labels
150-
* @param callable|string|PropertyPath|null $index The callable or path generating the view indices
151-
* @param callable|string|PropertyPath|null $groupBy The callable or path generating the group names
152-
* @param array|callable|string|PropertyPath|null $attr The callable or path generating the HTML attributes
153-
* @param array|callable|string|PropertyPath $labelTranslationParameters The callable or path generating the parameters used to translate the choice labels
145+
* @param mixed $preferredChoices
146+
* @param mixed $label
147+
* @param mixed $index
148+
* @param mixed $groupBy
149+
* @param mixed $attr
150+
* @param mixed $labelTranslationParameters
154151
*
155-
* @return ChoiceListView The choice list view
152+
* @return ChoiceListView
156153
*/
157154
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null/*, $labelTranslationParameters = []*/)
158155
{
@@ -163,7 +160,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
163160
$label = new PropertyPath($label);
164161
}
165162

166-
if ($label instanceof PropertyPath) {
163+
if ($label instanceof PropertyPathInterface) {
167164
$label = function ($choice) use ($accessor, $label) {
168165
return $accessor->getValue($choice, $label);
169166
};
@@ -173,7 +170,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
173170
$preferredChoices = new PropertyPath($preferredChoices);
174171
}
175172

176-
if ($preferredChoices instanceof PropertyPath) {
173+
if ($preferredChoices instanceof PropertyPathInterface) {
177174
$preferredChoices = function ($choice) use ($accessor, $preferredChoices) {
178175
try {
179176
return $accessor->getValue($choice, $preferredChoices);
@@ -188,7 +185,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
188185
$index = new PropertyPath($index);
189186
}
190187

191-
if ($index instanceof PropertyPath) {
188+
if ($index instanceof PropertyPathInterface) {
192189
$index = function ($choice) use ($accessor, $index) {
193190
return $accessor->getValue($choice, $index);
194191
};
@@ -198,7 +195,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
198195
$groupBy = new PropertyPath($groupBy);
199196
}
200197

201-
if ($groupBy instanceof PropertyPath) {
198+
if ($groupBy instanceof PropertyPathInterface) {
202199
$groupBy = function ($choice) use ($accessor, $groupBy) {
203200
try {
204201
return $accessor->getValue($choice, $groupBy);
@@ -213,7 +210,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
213210
$attr = new PropertyPath($attr);
214211
}
215212

216-
if ($attr instanceof PropertyPath) {
213+
if ($attr instanceof PropertyPathInterface) {
217214
$attr = function ($choice) use ($accessor, $attr) {
218215
return $accessor->getValue($choice, $attr);
219216
};

‎src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,16 @@ private static function resolveValidationGroups($groups, FormInterface $form)
261261

262262
private static function getConstraintsInGroups($constraints, $group)
263263
{
264-
return array_filter($constraints, static function (Constraint $constraint) use ($group) {
265-
return \in_array($group, $constraint->groups, true);
264+
$groups = (array) $group;
265+
266+
return array_filter($constraints, static function (Constraint $constraint) use ($groups) {
267+
foreach ($groups as $group) {
268+
if (\in_array($group, $constraint->groups, true)) {
269+
return true;
270+
}
271+
}
272+
273+
return false;
266274
});
267275
}
268276
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.