8000 feature #59035 [VarDumper] Add casters for object-converted resources… · symfony/symfony@c98cfb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit c98cfb6

Browse files
feature #59035 [VarDumper] Add casters for object-converted resources (alexandre-daubois)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [VarDumper] Add casters for object-converted resources | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | yes | Deprecations? | yes | Issues | - | License | MIT This PR makes up for the backlog of resources transformed into objects in the latest versions of PHP. ✅ Support added (or already existing with an update in `AbstractCloner`): - ext-curl - `CurlMultiHandle`: **no information to gather** - ext-openssl - `OpenSSLCertificateSigningRequest` - `OpenSSLAsymmetricKey` - ext-finfo - **No information to gather** - ext-sqlite3 - `Sqlite3Result` - ext-sockets - `Sockets` (to rebase on #59026) - ext-pgsql - `PgSql\Lob` - `PgSql\Connection` - `PgSql\Result` ⚠️ Remaining classes I couldn't test/find enough info yet (introduced in PHP 8.4): - `Odbc\Connection` - `Odbc\Result` - `Soap\Url` - `Soap\Sdl` Commits ------- 7be6483 [VarDumper] Add casters for object-converted resources
2 parents 8f04a56 + 7be6483 commit c98cfb6

38 files changed

+696
-41
lines changed

UPGRADE-7.3.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ Serializer
1919
----------
2020

2121
* Deprecate the `CompiledClassMetadataFactory` and `CompiledClassMetadataCacheWarmer` classes
22+
23+
VarDumper
24+
---------
25+
26+
* Deprecate `ResourceCaster::castCurl()`, `ResourceCaster::castGd()` and `ResourceCaster::castOpensslX509()`
27+
* Mark all casters as `@internal`

src/Symfony/Component/VarDumper/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
CHANGELOG
22
=========
33

4+
7.3
5+
---
6+
7+
* Add casters for `Dba\Connection`, `SQLite3Result`, `OpenSSLAsymmetricKey` and `OpenSSLCertificateSigningRequest`
8+
* Deprecate `ResourceCaster::castCurl()`, `ResourceCaster::castGd()` and `ResourceCaster::castOpensslX509()`
9+
* Mark all casters as `@internal`
10+
411
7.2
512
---
613

src/Symfony/Component/VarDumper/Caster/AddressInfoCaster.php

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

1616
/**
1717
* @author Nicolas Grekas <p@tchwork.com>
18+
*
19+
* @internal since Symfony 7.3
1820
*/
1921
final class AddressInfoCaster
2022
{

src/Symfony/Component/VarDumper/Caster/AmqpCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* @author Grégoire Pineau <lyrixx@lyrixx.info>
2020
*
2121
* @final
22+
*
23+
* @internal since Symfony 7.3
2224
*/
2325
class AmqpCaster
2426
{

src/Symfony/Component/VarDumper/Caster/Caster.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class Caster
4646
* Casts objects to arrays and adds the dynamic property prefix.
4747
*
4848
* @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not
49+
*
50+
* @internal since Symfony 7.3
4951
*/
5052
public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, ?string $debugClass = null): array
5153
{
@@ -162,6 +164,9 @@ public static function filter(array $a, int $filter, array $listedProperties = [
162164
return $a;
163165
}
164166

167+
/**
168+
* @internal since Symfony 7.3
169+
*/
165170
public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array
166171
{
167172
if (isset($a['__PHP_Incomplete_Class_Name'])) {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\VarDumper\Caster;
13+
14+
use Symfony\Component\VarDumper\Cloner\Stub;
15+
16+
/**
17+
* @author Nicolas Grekas <p@tchwork.com>
18+
*
19+
* @internal
20+
*/
21+
final class CurlCaster
22+
{
23+
public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array
24+
{
25+
foreach (curl_getinfo($h) as $key => $val) {
26+
$a[Caster::PREFIX_VIRTUAL.$key] = $val;
27+
}
28+
29+
return $a;
30+
}
31+
}

src/Symfony/Component/VarDumper/Caster/DOMCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* @author Nicolas Grekas <p@tchwork.com>
2020
*
2121
* @final
22+
*
23+
* @internal since Symfony 7.3
2224
*/
2325
class DOMCaster
2426
{

src/Symfony/Component/VarDumper/Caster/DateCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* @author Dany Maillard <danymaillard93b@gmail.com>
2020
*
2121
* @final
22+
*
23+
* @internal since Symfony 7.3
2224
*/
2325
class DateCaster
2426
{

src/Symfony/Component/VarDumper/Caster/DoctrineCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* @author Nicolas Grekas <p@tchwork.com>
2323
*
2424
* @final
25+
*
26+
* @internal since Symfony 7.3
2527
*/
2628
class DoctrineCaster
2729
{

src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* @author Nicolas Grekas <p@tchwork.com>
2323
*
2424
* @final
25+
*
26+
* @internal since Symfony 7.3
2527
*/
2628
class ExceptionCaster
2729
{

0 commit comments

Comments
 (0)
0