Skip to content

Commit e402750

Browse files
committed
Treat uninitialized property as null
1 parent 4502498 commit e402750

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## 2.5.1 under development
44

55
- Bug #776: Take `PropertyTranslatorProviderInterface` into account during context validation (@vjik)
6+
- Enh #???: Default Intl locale in tests (@batyrmastyr)
7+
- Enh #???: Support validation of uninitialized properties (@batyrmastyr)
68

79
## 2.5.0 July 19, 2025
810

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
>
1616
<php>
1717
<ini name="error_reporting" value="-1"/>
18+
<ini name="intl.default_locale" value="en"/>
1819
</php>
1920

2021
<testsuites>

tests/Helper/ObjectParserTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,18 @@ public function testDisabledCache(): void
178178
$this->assertNotSame($rules, $parser->getRules());
179179
$this->assertArrayNotHasKey($cacheKey, $cacheProperty->getValue());
180180
}
181+
182+
public function testUninitializedProperty(): void
183+
{
184+
$parser = new ObjectParser(new class () {
185+
public int $a = 4;
186+
public int $uninitialized;
187+
});
188+
189+
$this->assertNull($parser->getPropertyValue('not-existing'));
190+
$this->assertSame(4, $parser->getPropertyValue('a'));
191+
$this->assertNull($parser->getPropertyValue('uninitialized'));
192+
193+
$this->assertSame(['a' => 4], $parser->getData());;
194+
}
181195
}

0 commit comments

Comments
 (0)