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

Skip to content

Commit ca56620

Browse files
Fix deprecations on PHP 8.2
1 parent 75bf7fa commit ca56620

File tree

23 files changed

+204
-77
lines changed

23 files changed

+204
-77
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- php: '8.1'
2727
mode: low-deps
2828
- php: '8.2'
29-
mode: experimental
29+
#mode: experimental
3030
fail-fast: false
3131

3232
runs-on: ubuntu-20.04

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

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

1414
use Doctrine\Common\Collections\ArrayCollection;
1515
use Doctrine\DBAL\Types\Type;
16+
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1617
use Doctrine\ORM\Tools\SchemaTool;
1718
use Doctrine\Persistence\ManagerRegistry;
18-
use Doctrine\Persistence\Mapping\ClassMetadata;
1919
use Doctrine\Persistence\ObjectManager;
2020
use Doctrine\Persistence\ObjectRepository;
2121
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
@@ -111,7 +111,7 @@ protected function createEntityManagerMock($repositoryMock)
111111
->willReturn($repositoryMock)
112112
;
113113

114-
$classMetadata = $this->createMock(ClassMetadata::class);
114+
$classMetadata = $this->createMock(ClassMetadataInfo::class);
115115
$classMetadata
116116
->expects($this->any())
117117
->method('hasField')

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ function ($definition) {
194194
}
195195
}
196196

197+
#[\AllowDynamicProperties]
197198
final class DummyClass implements DummyInterface, SunnyInterface
198199
{
199200
private $ref;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617

@@ -28,14 +29,18 @@ public function process(ContainerBuilder $container)
2829
// "annotation_reader" at build time don't get any cache
2930
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
3031
$reader = $container->getDefinition($id);
32+
$reader->setPublic(false);
3133
$properties = $reader->getProperties();
3234

3335
if (isset($properties['cacheProviderBackup'])) {
3436
$provider = $properties['cacheProviderBackup']->getValues()[0];
3537
unset($properties['cacheProviderBackup']);
3638
$reader->setProperties($properties);
37-
$container->set($id, null);
38-
$container->setDefinition($id, $reader->replaceArgument(1, $provider));
39+
$reader->replaceArgument(1, $provider);
40+
} elseif (4 <= \count($arguments = $reader->getArguments()) && $arguments[3] instanceof ServiceClosureArgument) {
41+
$arguments[1] = $arguments[3]->getValues()[0];
42+
unset($arguments[3]);
43+
$reader->setArguments($arguments);
3944
}
4045
}
4146
}

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,10 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
14631463

14641464
$container
14651465
->getDefinition('annotations.cached_reader')
1466+
->setPublic(true) // set to false in AddAnnotationsCachedReaderPass
14661467
->replaceArgument(2, $config['debug'])
1467-
// temporary property to lazy-reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1468-
->setProperty('cacheProviderBackup', new ServiceClosureArgument(new Reference($cacheService)))
1468+
// reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
1469+
->addArgument(new ServiceClosureArgument(new Reference($cacheService)))
14691470
->addTag('annotations.cached_reader')
14701471
;
14711472

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static function configureStatic1()
5656

5757
class BarUserClass
5858
{
59+
public $foo;
5960
public $bar;
6061

6162
public function __construct(BarClass $bar)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
class FooClass
66
{
7+
public $qux;
78
public $foo;
89
public $moo;
910

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,11 +1214,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
12141214
set_error_handler(function () { throw new \Exception(); });
12151215

12161216
try {
1217-
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
1217+
return mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], $charset);
12181218
} catch (\Exception|\ValueError $e) {
12191219
try {
12201220
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
1221-
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
1221+
$htmlContent = mb_encode_numericentity($htmlContent, [0x80, 0xFFFF, 0, 0xFFFF], 'UTF-8');
12221222
} catch (\Exception|\ValueError $e) {
12231223
}
12241224

src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class MockStream
1919
{
20+
public $context;
21+
2022
/**
2123
* Opens file or URL.
2224
*

src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectDummy.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Symfony\Component\Serializer\Tests\Normalizer\Features;
44

5+
#[\AllowDynamicProperties]
56
class ObjectDummy
67
{
78
protected $foo;

0 commit comments

Comments
 (0)