<?php namespace MyApp; final class Book { /** @var string */ public $title; /** @var \MyApp\Author[] */ public $authors; /** @var \MyApp\ISBN */ public $isbn; /** @var string */ public $lang; // expects en|fr|zh|ru|es|ar }
You can write this code instead of as follows.
<?php namespace MyApp; /** * @property string $title * @property \MyApp\Author[] $authors * @property \MyApp\ISBN $isbn * @property string $lang */ final class Book { use \Teto\Object\TypedProperty; protected static $property_types = [ 'title' => 'string', 'authors' => 'MyApp\Author[]', 'isbn' => '?MyApp\ISBN', 'lang' => 'enum', ]; protected static $enum_values = [ 'lang' => ['en', 'fr', 'zh', 'ru', 'es', 'ar'], ]; }
There was an error while loading. Please reload this page.