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

Skip to content

Commit 77d9f7a

Browse files
[VarExporter] a new component to serialize values to plain PHP code
1 parent 2df7320 commit 77d9f7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+603
-427
lines changed

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ return PhpCsFixer\Config::create()
2424
->exclude(array(
2525
'Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures',
2626
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
27-
'Symfony/Component/Cache/Tests/Marshaller/Fixtures',
2827
'Symfony/Component/DependencyInjection/Tests/Fixtures',
2928
'Symfony/Component/Routing/Tests/Fixtures/dumper',
3029
// fixture templates
@@ -33,6 +32,7 @@ return PhpCsFixer\Config::create()
3332
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
3433
// generated fixtures
3534
'Symfony/Component/VarDumper/Tests/Fixtures',
35+
'Symfony/Component/VarExporter/Tests/Fixtures',
3636
// resource templates
3737
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
3838
// explicit trigger_error tests

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"symfony/twig-bundle": "self.version",
8282
"symfony/validator": "self.version",
8383
"symfony/var-dumper": "self.version",
84+
"symfony/var-exporter": "self.version",
8485
"symfony/web-link": "self.version",
8586
"symfony/web-profiler-bundle": "self.version",
8687
"symfony/web-server-bundle": "self.version",

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/array-iterator.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/array-object-custom.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/array-object.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/bool.php

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/clone.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/datetime.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/hard-references-recursive.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/hard-references.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/incomplete-class.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/private.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/serializable.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/simple-array.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/spl-object-storage.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Symfony/Component/Cache/Tests/Marshaller/Fixtures/wakeup.php

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Symfony/Component/Cache/Traits/PhpArrayTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Cache\CacheItem;
1515
use Symfony\Component\Cache\Exception\InvalidArgumentException;
16-
use Symfony\Component\Cache\Marshaller\PhpMarshaller;
16+
use Symfony\Component\VarExporter\VarExporter;
1717

1818
/**
1919
* @author Titouan Galopin <[email protected]>
@@ -76,7 +76,7 @@ public function warmUp(array $values)
7676
$value = "'N;'";
7777
} elseif (\is_object($value) || \is_array($value)) {
7878
try {
79-
$value = PhpMarshaller::marshall($value, $isStaticValue);
79+
$value = VarExporter::export($value, $isStaticValue);
8080
} catch (\Exception $e) {
8181
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \is_object($value) ? \get_class($value) : 'array'), 0, $e);
8282
}

0 commit comments

Comments
 (0)