Skip to content

Commit 49757bb

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: fix merge add back setAccessible() for PHP 7 compatibility Update BrevoRequestParser.php [JsonStreamer] Add `include_null_properties` option [Translation] Add `StaticMessage` [Form][PhpUnitBridge] Remove usage of noop `ReflectionProperty::setAccessible()` fix compatibility with different Relay versions [VarDumper][Serializer] Remove require php 8.2 from tests [HttpKernel] Remove outdated phpdoc [Console] Fix JSON description for negatable input flags [JsonStreamer] Allow to access current object when writing
2 parents 68a7297 + 72ccba7 commit 49757bb

38 files changed

+419
-178
lines changed

src/Symfony/Bridge/PhpUnit/CoverageListener.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function startTest(Test $test): void
8686
private function addCoversForClassToAnnotationCache(Test $test, array $covers): void
8787
{
8888
$r = new \ReflectionProperty(TestUtil::class, 'annotationCache');
89-
$r->setAccessible(true);
9089

9190
$cache = $r->getValue();
9291
$cache = array_replace_recursive($cache, [
@@ -103,7 +102,6 @@ private function addCoversForDocBlockInsideRegistry(Test $test, array $covers):
103102
$docBlock = Registry::getInstance()->forClassName($test::class);
104103

105104
$symbolAnnotations = new \ReflectionProperty($docBlock, 'symbolAnnotations');
106-
$symbolAnnotations->setAccessible(true);
107105

108106
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
109107
$covers = array_filter($covers, function (string $class) {

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ public function toString(): string
389389
{
390390
$exception = new \Exception($this->message);
391391
$reflection = new \ReflectionProperty($exception, 'trace');
392-
$reflection->setAccessible(true);
393392
$reflection->setValue($exception, $this->trace);
394393

395394
return ($this->originatesFromAnObject() ? 'deprecation triggered by '.$this->originatingClass().'::'.$this->originatingMethod().":\n" : '')

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ private function willBeIsolated(TestCase $test): bool
348348
}
349349

350350
$r = new \ReflectionProperty($test, 'runTestInSeparateProcess');
351-
$r->setAccessible(true);
352351

353352
return $r->getValue($test) ?? false;
354353
}

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ public static function setUpBeforeClass(): void
275275
$loader = require $v.'/autoload.php';
276276
$reflection = new \ReflectionClass($loader);
277277
$prop = $reflection->getProperty('prefixDirsPsr4');
278-
$prop->setAccessible(true);
279278
$currentValue = $prop->getValue($loader);
280279
self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue];
281280
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];

src/Symfony/Component/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private function getInputOptionData(InputOption $option, bool $negated = false):
108108
'is_value_required' => false,
109109
'is_multiple' => false,
110110
'description' => 'Negate the "--'.$option->getName().'" option',
111-
'default' => false,
111+
'default' => null === $option->getDefault() ? null : !$option->getDefault(),
112112
] : [
113113
'name' => '--'.$option->getName(),
114114
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',

src/Symfony/Component/Console/Tests/Descriptor/JsonDescriptorTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ private function normalizeOutputRecursively($output)
3636
return array_map($this->normalizeOutputRecursively(...), $output);
3737
}
3838

39-
if (null === $output) {
40-
return null;
41-
}
42-
43-
return parent::normalizeOutput($output);
39+
return match ($output) {
40+
null, true, false => $output,
41+
default => parent::normalizeOutput($output),
42+
};
4443
}
4544
}

src/Symfony/Component/Console/Tests/Fixtures/application_2.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"is_value_required": false,
9595
"is_multiple": false,
9696
"description": "Do not ask any interactive question",
97-
"default": false
97+
"default": null
9898
},
9999
"shell": {
100100
"name": "--shell",
@@ -224,7 +224,7 @@
224224
"is_value_required": false,
225225
"is_multiple": false,
226226
"description": "Do not ask any interactive question",
227-
"default": false
227+
"default": null
228228
},
229229
"debug": {
230230
"name": "--debug",
@@ -345,7 +345,7 @@
345345
"is_value_required": false,
346346
"is_multiple": false,
347347
"description": "Do not ask any interactive question",
348-
"default": false
348+
"default": null
349349
}
350350
}
351351
}
@@ -457,7 +457,7 @@
457457
"is_value_required": false,
458458
"is_multiple": false,
459459
"description": "Do not ask any interactive question",
460-
"default": false
460+
"default": null
461461
},
462462
"short": {
463463
"name": "--short",
@@ -554,7 +554,7 @@
554554
"is_value_required": false,
555555
"is_multiple": false,
556556
"description": "Do not ask any interactive question",
557-
"default": false
557+
"default": null
558558
}
559559
}
560560
}
@@ -659,7 +659,7 @@
659659
"is_value_required": false,
660660
"is_multiple": false,
661661
"description": "Do not ask any interactive question",
662-
"default": false
662+
"default": null
663663
}
664664
}
665665
}
@@ -745,7 +745,7 @@
745745
"is_value_required": false,
746746
"is_multiple": false,
747747
"description": "Do not ask any interactive question",
748-
"default": false
748+
"default": null
749749
}
750750
}
751751
}
@@ -833,7 +833,7 @@
833833
"is_value_required": false,
834834
"is_multiple": false,
835835
"description": "Do not ask any interactive question",
836-
"default": false
836+
"default": null
837837
}
838838
}
839839
}

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,6 @@ public function testRoundMethodKeepsIntegersAsIntegers()
754754
// Use reflection to test the private round() method directly
755755
$reflection = new \ReflectionClass($transformer);
756756
$roundMethod = $reflection->getMethod('round');
757-
$roundMethod->setAccessible(true);
758757

759758
$int = \PHP_INT_MAX - 1;
760759
$result = $roundMethod->invoke($transformer, $int);

src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadata.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public function getName(): string
4646

4747
/**
4848
* Returns the type of the argument.
49-
*
50-
* The type is the PHP class in 5.5+ and additionally the basic type in PHP 7.0+.
5149
*/
5250
public function getType(): ?string
5351
{

src/Symfony/Component/JsonStreamer/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ CHANGELOG
55
---
66

77
* Remove `nikic/php-parser` dependency
8+
* Add `_current_object` to the context passed to value transformers during write operations
9+
* Add `include_null_properties` option to encode the properties with `null` value
810

911
7.3
1012
---

0 commit comments

Comments
 (0)