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

Various cleanups #59980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions 17 .github/expected-missing-return-types.diff
Original file line number Diff line number Diff line change
Expand Up @@ -593,23 +593,6 @@ diff --git a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php b/sr
- public function dump(Data $data);
+ public function dump(Data $data): ?string;
}
diff --git a/src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php b/src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php
--- a/src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php
+++ b/src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php
@@ -172,5 +172,5 @@ class ProxyHelperTest extends TestCase
{
yield 'not type hinted __unserialize method' => [new class {
- public function __unserialize($array)
+ public function __unserialize($array): void
{
}
@@ -192,5 +192,5 @@ class ProxyHelperTest extends TestCase

yield 'type hinted __unserialize method' => [new class {
- public function __unserialize(array $array)
+ public function __unserialize(array $array): void
{
}
diff --git a/src/Symfony/Contracts/Translation/LocaleAwareInterface.php b/src/Symfony/Contracts/Translation/LocaleAwareInterface.php
--- a/src/Symfony/Contracts/Translation/LocaleAwareInterface.php
+++ b/src/Symfony/Contracts/Translation/LocaleAwareInterface.php
Expand Down
116 changes: 58 additions & 58 deletions 116 UPGRADE-7.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,10 @@ Read more about this in the [Symfony documentation](https://symfony.com/doc/7.3/

If you're upgrading from a version below 7.2, follow the [7.2 upgrade guide](UPGRADE-7.2.md) first.

Ldap
----

* Deprecate `LdapUser::eraseCredentials()` in favor of `__serialize()`

Security
--------

* Deprecate `UserInterface::eraseCredentials()` and `TokenInterface::eraseCredentials()`;
erase credentials e.g. using `__serialize()` instead

Before:

```php
public function eraseCredentials(): void
{
}
```

After:

```php
#[\Deprecated]
public function eraseCredentials(): void
{
}

// If your eraseCredentials() method was used to empty a "password" property:
public function __serialize(): array
{
$data = (array) $this;
unset($data["\0".self::class."\0password"]);

return $data;
}
```

* Add argument `$vote` to `VoterInterface::vote()` and to `Voter::voteOnAttribute()`;
it should be used to report the reason of a vote. E.g:

```php
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
{
$vote ??= new Vote();

$vote->reasons[] = 'A brief explanation of why access is granted or denied, as appropriate.';
}
```

* Add argument `$accessDecision` to `AccessDecisionManagerInterface::decide()` and `AuthorizationCheckerInterface::isGranted()`;
it should be used to report the reason of a decision, including all the related votes.
AssetMapper
-----------

* Add discovery support to `OidcTokenHandler` and `OidcUserInfoTokenHandler`
* `ImportMapRequireCommand` now takes `projectDir` as a required third constructor argument

Console
-------
Expand Down Expand Up @@ -96,10 +47,15 @@ FrameworkBundle
* Deprecate the `--show-arguments` option of the `container:debug` command, as arguments are now always shown
* Deprecate the `framework.validation.cache` config option

Ldap
----

* Deprecate `LdapUser::eraseCredentials()` in favor of `__serialize()`

OptionsResolver
---------------

* Deprecate defining nested options via `setDefault()`, use `setOptions()` instead
* Deprecate defining nested options via `setDefault()`, use `setOptions()` instead

*Before*
```php
Expand All @@ -115,6 +71,55 @@ OptionsResolver
});
```

Security
--------

* Deprecate `UserInterface::eraseCredentials()` and `TokenInterface::eraseCredentials()`;
erase credentials e.g. using `__serialize()` instead

Before:

```php
public function eraseCredentials(): void
{
}
```

After:

```php
#[\Deprecated]
public function eraseCredentials(): void
{
}

// If your eraseCredentials() method was used to empty a "password" property:
public function __serialize(): array
{
$data = (array) $this;
unset($data["\0".self::class."\0password"]);

return $data;
}
```

* Add argument `$vote` to `VoterInterface::vote()` and to `Voter::voteOnAttribute()`;
it should be used to report the reason of a vote. E.g:

```php
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool
{
$vote ??= new Vote();

$vote->reasons[] = 'A brief explanation of why access is granted or denied, as appropriate.';
}
```

* Add argument `$accessDecision` to `AccessDecisionManagerInterface::decide()` and `AuthorizationCheckerInterface::isGranted()`;
it should be used to report the reason of a decision, including all the related votes.

* Add discovery support to `OidcTokenHandler` and `OidcUserInfoTokenHandler`

SecurityBundle
--------------

Expand Down Expand Up @@ -191,8 +196,3 @@ VarDumper

* Deprecate `ResourceCaster::castCurl()`, `ResourceCaster::castGd()` and `ResourceCaster::castOpensslX509()`
* Mark all casters as `@internal`

AssetMapper
-----------

* `ImportMapRequireCommand` now takes `projectDir` as a required third constructor argument
7 changes: 3 additions & 4 deletions 7 src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Cache\Traits\RedisProxyTrait;
use Symfony\Component\Cache\Traits\RelayClusterProxy;
use Symfony\Component\Cache\Traits\RelayProxy;
use Symfony\Component\VarExporter\LazyProxyTrait;
use Symfony\Component\VarExporter\ProxyHelper;

class RedisProxiesTest extends TestCase
Expand All @@ -37,7 +36,7 @@ public function testRedisProxy($class)
$methods = [];

foreach ((new \ReflectionClass(\sprintf('Symfony\Component\Cache\Traits\\%s%dProxy', $class, $version)))->getMethods() as $method) {
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name)) {
if ('reset' === $method->name || method_exists(RedisProxyTrait::class, $method->name)) {
continue;
}
$return = '__construct' === $method->name || $method->getReturnType() instanceof \ReflectionNamedType && 'void' === (string) $method->getReturnType() ? '' : 'return ';
Expand Down Expand Up @@ -89,7 +88,7 @@ public function testRelayProxy()
$expectedMethods = [];

foreach ((new \ReflectionClass(RelayProxy::class))->getMethods() as $method) {
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name) || $method->isStatic()) {
if ('reset' === $method->name || method_exists(RedisProxyTrait::class, $method->name) || $method->isStatic()) {
continue;
}

Expand Down Expand Up @@ -136,7 +135,7 @@ public function testRelayClusterProxy()
$expectedMethods = [];

foreach ((new \ReflectionClass(RelayClusterProxy::class))->getMethods() as $method) {
if ('reset' === $method->name || method_exists(LazyProxyTrait::class, $method->name) || $method->isStatic()) {
if ('reset' === $method->name || method_exists(RedisProxyTrait::class, $method->name) || $method->isStatic()) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
continue;
}

if (\PHP_VERSION_ID >= 80400 && (new \ReflectionClass($service))->isUninitializedLazyObject($service)) {

Check failure on line 49 in src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedMethod

src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php:49:79: UndefinedMethod: Method ReflectionClass::isUninitializedLazyObject does not exist (see https://psalm.dev/022)

Check failure on line 49 in src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedMethod

src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php:49:79: UndefinedMethod: Method ReflectionClass::isUninitializedLazyObject does not exist (see https://psalm.dev/022)
continue;
}

foreach ((array) $this->resetMethods[$id] as $resetMethod) {
if ('?' === $resetMethod[0] && !method_exists($service, $resetMethod = substr($resetMethod, 1))) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
*
* @deprecated since Symfony 7.3, native lazy objects will be used instead
*
* @internal
*/
final class LazyGhostCacheWarmer extends CacheWarmer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\JsonStreamer\CacheWarmer\LazyGhostCacheWarmer;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;

/**
* @group legacy
*/
class LazyGhostCacheWarmerTest extends TestCase
{
private string $lazyGhostsDir;
Expand Down
26 changes: 15 additions & 11 deletions 26 src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1032,21 +1032,25 @@ public function testIsReadableWithMissingPropertyAndLazyGhost()

private function createUninitializedObjectPropertyGhost(): UninitializedObjectProperty
{
if (!class_exists(ProxyHelper::class)) {
$this->markTestSkipped(\sprintf('Class "%s" is required to run this test.', ProxyHelper::class));
}
if (\PHP_VERSION_ID < 80400) {
if (!class_exists(ProxyHelper::class)) {
$this->markTestSkipped(\sprintf('Class "%s" is required to run this test.', ProxyHelper::class));
}

$class = 'UninitializedObjectPropertyGhost';
$class = 'UninitializedObjectPropertyGhost';

if (!class_exists($class)) {
eval('class '.$class.ProxyHelper::generateLazyGhost(new \ReflectionClass(UninitializedObjectProperty::class)));
}
if (!class_exists($class)) {
eval('class '.$class.ProxyHelper::generateLazyGhost(new \ReflectionClass(UninitializedObjectProperty::class)));
}

$this->assertTrue(class_exists($class));
$this->assertTrue(class_exists($class));

return $class::createLazyGhost(initializer: function ($instance) {
});
}
return $class::createLazyGhost(initializer: function ($instance) {
});
}

return (new \ReflectionClass(UninitializedObjectProperty::class))->newLazyGhost(fn () => null);
}

/**
* @requires PHP 8.4
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/VarExporter/Tests/ProxyHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testGenerateLazyProxyForClassWithUnserializeMagicMethod(object $
public static function classWithUnserializeMagicMethodProvider(): iterable
{
yield 'not type hinted __unserialize method' => [new class {
public function __unserialize($array)
public function __unserialize($array): void
{
}
}, <<<'EOPHP'
Expand All @@ -192,7 +192,7 @@ public function __unserialize($data): void
EOPHP];

yield 'type hinted __unserialize method' => [new class {
public function __unserialize(array $array)
public function __unserialize(array $array): void
{
}
}, <<<'EOPHP'
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.