-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Since PHP 7.4 type declarations were introduced.
But php-avro-schema-generator does not look in it.
Steps to reproduce:
// in ../DAO/DemoNotification.php
class DemoNotification {
private string $content;
public function __construct(string $content) {
$this->content = $content;
}
public function getContent(): string {
return $this->content;
}
}
$data = new DemoNotification("Hello");
$registry = (new ClassRegistry())
->addClassDirectory(__DIR__ . '/../DAO')
->load();
$generator = new SchemaGenerator($registry, '');
$schemas = $generator->generate();
echo(current($schemas)); // Out: {"type":"record","name":"DemoNotification","namespace":"App.DAO","fields":[{"name":"content","type":""}]}Actual behavior
Despite explicit type declaration:
private string $content;
Script outputs:
{"type":"record","name":"DemoNotification","namespace":"App.DAO","fields":[{"name":"content","type":""}]}Expected behavior
{"type":"record","name":"DemoNotification","namespace":"App.DAO","fields":[{"name":"content","type":"string"}]}Metadata
Metadata
Assignees
Labels
No labels