php-json-schema icon indicating copy to clipboard operation
php-json-schema copied to clipboard

A few typing opportunities still exist in ClassStructureTrait and Schema

Open skewty opened this issue 5 years ago • 0 comments

trait ClassStructureTrait
{
    use ObjectItemTrait;

    /**
     * Add union static here so nested object fields can be type hinted as such:
     *      class Book extends ClassStructure { public Author $author; }
     * without getting a type warning from IDE (phpStorm).
     * 
     * @return Wrapper|static
     */
    public static function schema()
class Schema extends JsonSchema implements MetaHolder, SchemaContract, HasDefault
{
    /**
     * Add union int here so fields can be type hinted as such:
     *      class Book extends ClassStructure { public int $id; }
     * without getting a type warning from IDE (phpStorm).
     * 
     * @return static|int
     */
    public static function integer() 

   // similar union typing should exist for the others like: string, boolean, number
}

skewty avatar Mar 02 '21 20:03 skewty