swaggest / php-json-schema

High definition PHP structures with JSON-schema based validation
MIT License
446 stars 50 forks source link

A few typing opportunities still exist in ClassStructureTrait and Schema #114

Open skewty opened 3 years ago

skewty commented 3 years ago
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
}