- Add test case for namespaced class name escaping in C++ string generation - Verify proper error message display for type mismatch in namespaced properties - Test native scalar property assignments with configuration arrays - Validate TypeError handling for invalid type assignments in namespaced context fix(compiler): ensure namespaced class names are properly escaped in property type checks - Update genCharPtr call with escape parameter set to true - Fix object property type check display name generation for namespaced classes - Maintain backward compatibility with existing property access patternspull/20/head
parent
bd802ba9c4
commit
37eb77a0b8
2 changed files with 44 additions and 1 deletions
@ -0,0 +1,43 @@ |
|||||||
|
--TEST-- |
||||||
|
Native scalar property diagnostics escape namespaced class names in generated C++ strings |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
namespace Px\C4129Repro { |
||||||
|
use native_types; |
||||||
|
|
||||||
|
class NamespacedScalarProperty |
||||||
|
{ |
||||||
|
public int $intValue = 0; |
||||||
|
public float $floatValue = 0.0; |
||||||
|
public bool $boolValue = false; |
||||||
|
|
||||||
|
public function assign(array $config): void |
||||||
|
{ |
||||||
|
$this->intValue = $config['int'] ?? 1; |
||||||
|
$this->floatValue = $config['float'] ?? 2.5; |
||||||
|
$this->boolValue = $config['bool'] ?? false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
namespace { |
||||||
|
function main(): void |
||||||
|
{ |
||||||
|
$box = new \Px\C4129Repro\NamespacedScalarProperty(); |
||||||
|
$box->assign(['int' => 12, 'float' => 3.5, 'bool' => true]); |
||||||
|
|
||||||
|
var_dump($box->intValue, $box->floatValue, $box->boolValue); |
||||||
|
|
||||||
|
try { |
||||||
|
$box->assign(['int' => 1, 'float' => 2.5, 'bool' => 'invalid']); |
||||||
|
} catch (\TypeError $e) { |
||||||
|
var_dump($e->getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
int(12) |
||||||
|
float(3.5) |
||||||
|
bool(true) |
||||||
|
string(96) "Cannot assign string to property Px\C4129Repro\NamespacedScalarProperty::$boolValue of type bool" |
||||||
Loading…
Reference in new issue