8000 Merge branch '6.4' into 7.1 · symfony/property-info@17a97fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 17a97fd

Browse files
Merge branch '6.4' into 7.1
* 6.4: [DoctrineBridge] Fix Connection::createSchemaManager() for Doctrine DBAL v2 [HttpClient] Various cleanups after recent changes do not add child nodes to EmptyNode instances consider write property visibility to decide whether a property is writable add comment explaining why HttpClient tests are run separately silence warnings issued by Redis Sentinel on connection issues
2 parents 402ab84 + 5786298 commit 17a97fd

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Extractor/ReflectionExtractor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,10 @@ private function isAllowedProperty(string $class, string $property, bool $writeA
704704
return false;
705705
}
706706

707+
if (\PHP_VERSION_ID >= 80400 && $writeAccessRequired && ($reflectionProperty->isProtectedSet() || $reflectionProperty->isPrivateSet())) {
708+
return false;
709+
}
710+
707711
return (bool) ($reflectionProperty->getModifiers() & $this->propertyReflectionFlags);
708712
} catch (\ReflectionException) {
709713
// Return false if the property doesn't exist

Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\PropertyInfo\PropertyReadInfo;
1717
use Symfony\Component\PropertyInfo\PropertyWriteInfo;
1818
use Symfony\Component\PropertyInfo\Tests\Fixtures\AdderRemoverDummy;
19+
use Symfony\Component\PropertyInfo\Tests\Fixtures\AsymmetricVisibility;
1920
use Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy;
2021
use Symfony\Component\PropertyInfo\Tests\Fixtures\DefaultValue;
2122
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
@@ -689,6 +690,19 @@ public static function provideLegacyExtractConstructorTypes(): array
689690
];
690691
}
691692

693+
/**
694+
* @requires PHP 8.4
695+
*/
696+
public function testAsymmetricVisibility()
697+
{
698+
$this->assertTrue($this->extractor->isReadable(AsymmetricVisibility::class, 'publicPrivate'));
699+
$this->assertTrue($this->extractor->isReadable(AsymmetricVisibility::class, 'publicProtected'));
700+
$this->assertFalse($this->extractor->isReadable(AsymmetricVisibility::class, 'protectedPrivate'));
701+
$this->assertFalse($this->extractor->isWritable(AsymmetricVisibility::class, 'publicPrivate'));
702+
$this->assertFalse($this->extractor->isWritable(AsymmetricVisibility::class, 'publicProtected'));
703+
$this->assertFalse($this->extractor->isWritable(AsymmetricVisibility::class, 'protectedPrivate'));
704+
}
705+
692706
/**
693707
* @dataProvider typesProvider
694708
*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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\PropertyInfo\Tests\Fixtures;
13+
14+
class AsymmetricVisibility
15+
{
16+
public private(set) mixed $publicPrivate;
17+
public protected(set) mixed $publicProtected;
18+
protected private(set) mixed $protectedPrivate;
19+
}

0 commit comments

Comments
 (0)
0