Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[VarDumper] Remove deprecated resource casters #60812

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
Jun 18, 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
32 changes: 1 addition & 31 deletions src/Symfony/Component/VarDumper/Caster/ResourceCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,10 @@
*
* @final
*
* @internal since Symfony 7.3
* @internal
*/
class ResourceCaster
{
/**
* @deprecated since Symfony 7.3
*/
public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array
{
trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__, CurlCaster::class);

return CurlCaster::castCurl($h, $a, $stub, $isNested);
}

public static function castDba(\Dba\Connection $dba, array $a, Stub $stub, bool $isNested): array
{
if (\PHP_VERSION_ID < 80402) {
Expand Down Expand Up @@ -66,24 +56,4 @@ public static function castStreamContext($stream, array $a, Stub $stub, bool $is
{
return @stream_context_get_params($stream) ?: $a;
}

/**
* @deprecated since Symfony 7.3
*/
public static function castGd(\GdImage $gd, array $a, Stub $stub, bool $isNested): array
{
trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__, GdCaster::class);

return GdCaster::castGd($gd, $a, $stub, $isNested);
}

/**
* @deprecated since Symfony 7.3
*/
public static function castOpensslX509(\OpenSSLCertificate $h, array $a, Stub $stub, bool $isNested): array
{
trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__, OpenSSLCaster::class);

return OpenSSLCaster::castOpensslX509($h, $a, $stub, $isNested);
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ abstract class AbstractCloner implements ClonerInterface

'Dba\Connection' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],

'GdImage' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
'GdImage' => ['Symfony\Component\VarDumper\Caster\GdCaster', 'castGd'],

'SQLite3Result' => ['Symfony\Component\VarDumper\Caster\SqliteCaster', 'castSqlite3Result'],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,6 @@ class ResourceCasterTest extends TestCase
use ExpectUserDeprecationMessageTrait;
use VarDumperTestTrait;

/**
* @group legacy
*
* @requires extension curl
*/
public function testCastCurlIsDeprecated()
{
$ch = curl_init('http://example.com');
curl_setopt($ch, \CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);

$this->expectUserDeprecationMessage('Since symfony/var-dumper 7.3: The "Symfony\Component\VarDumper\Caster\ResourceCaster::castCurl()" method is deprecated without replacement.');

ResourceCaster::castCurl($ch, [], new Stub(), false);
}

/**
* @group legacy
*
* @requires extension gd
*/
public function testCastGdIsDeprecated()
{
$gd = imagecreate(1, 1);

$this->expectUserDeprecationMessage('Since symfony/var-dumper 7.3: The "Symfony\Component\VarDumper\Caster\ResourceCaster::castGd()" method is deprecated without replacement.');

ResourceCaster::castGd($gd, [], new Stub(), false);
}

/**
* @requires extension dba
*/
Expand Down
Loading