Skip to content

Commit 6a60cfc

Browse files
committed
minor symfony#44037 Never rely on dynamic properties (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- Never rely on dynamic properties | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - As described in https://wiki.php.net/rfc/deprecate_dynamic_properties Commits ------- aa4fb0c Never rely on dynamic properties
2 parents 419ccc5 + aa4fb0c commit 6a60cfc

File tree

19 files changed

+61
-19
lines changed

19 files changed

+61
-19
lines changed

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ function ($definition) {
196196

197197
final class DummyClass implements DummyInterface, SunnyInterface
198198
{
199+
private $ref;
200+
199201
public function dummy()
200202
{
201203
return $this;

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ public function testGetServiceIds()
253253
{
254254
$builder = new ContainerBuilder();
255255
$builder->register('foo', 'stdClass');
256-
$builder->bar = $bar = new \stdClass();
257256
$builder->register('bar', 'stdClass');
258257
$this->assertEquals(
259258
[

src/Symfony/Component/DependencyInjection/Tests/Fixtures/StdClassDecorator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
final class StdClassDecorator
66
{
7+
public $foo;
8+
79
public function __construct(\stdClass $foo)
810
{
911
$this->foo = $foo;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ public static function create($config)
142142

143143
class FoobarCircular
144144
{
145+
public $foo;
146+
145147
public function __construct(FooCircular $foo)
146148
{
147149
$this->foo = $foo;
@@ -150,6 +152,8 @@ public function __construct(FooCircular $foo)
150152

151153
class FooCircular
152154
{
155+
public $bar;
156+
153157
public function __construct(BarCircular $bar)
154158
{
155159
$this->bar = $bar;
@@ -158,6 +162,8 @@ public function __construct(BarCircular $bar)
158162

159163
class BarCircular
160164
{
165+
public $foobar;
166+
161167
public function addFoobar(FoobarCircular $foobar)
162168
{
163169
$this->foobar = $foobar;

src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ public function __invoke()
458458

459459
class TestEventListener
460460
{
461+
public $name;
461462
public $preFooInvoked = false;
462463
public $postFooInvoked = false;
463464

src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class KernelForTest extends Kernel
1919
{
2020
public function getBundleMap()
2121
{
22-
return $this->bundleMap;
22+
return [];
2323
}
2424

2525
public function registerBundles(): iterable

src/Symfony/Component/Mime/Part/DataPart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*/
2121
class DataPart extends TextPart
2222
{
23+
/** @internal */
24+
protected $_parent;
25+
2326
private static $mimeTypes;
2427

2528
private $filename;
@@ -32,6 +35,8 @@ class DataPart extends TextPart
3235
*/
3336
public function __construct($body, string $filename = null, string $contentType = null, string $encoding = null)
3437
{
38+
unset($this->_parent);
39+
3540
if (null === $contentType) {
3641
$contentType = 'application/octet-stream';
3742
}

src/Symfony/Component/Mime/Part/SMimePart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
class SMimePart extends AbstractPart
2020
{
21+
/** @internal */
22+
protected $_headers;
23+
2124
private $body;
2225
private $type;
2326
private $subtype;
@@ -28,6 +31,8 @@ class SMimePart extends AbstractPart
2831
*/
2932
public function __construct($body, string $type, string $subtype, array $parameters)
3033
{
34+
unset($this->_headers);
35+
3136
parent::__construct();
3237

3338
if (!\is_string($body) && !is_iterable($body)) {

src/Symfony/Component/Mime/Part/TextPart.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
*/
2424
class TextPart extends AbstractPart
2525
{
26+
/** @internal */
27+
protected $_headers;
28+
2629
private static $encoders = [];
2730

2831
private $body;
@@ -37,6 +40,8 @@ class TextPart extends AbstractPart
3740
*/
3841
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', string $encoding = null)
3942
{
43+
unset($this->_headers);
44+
4045
parent::__construct();
4146

4247
if (!\is_string($body) && !\is_resource($body)) {

src/Symfony/Component/Security/Core/Exception/AuthenticationException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@
2121
*/
2222
class AuthenticationException extends RuntimeException
2323
{
24+
/** @internal */
25+
protected $serialized;
26+
2427
private $token;
2528

29+
public function __construct(string $message = '', int $code = 0, \Throwable $previous = null)
30+
{
31+
unset($this->serialized);
32+
parent::__construct($message, $code, $previous);
33+
}
34+
2635
/**
2736
* Get the token.
2837
*

0 commit comments

Comments
 (0)