Re: Re: Improving PHP's type system

From: Date: Wed, 20 Apr 2016 08:47:10 +0000
Subject: Re: Re: Improving PHP's type system
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-92527@lists.php.net to get a copy of this message
On 20/04/16 00:34, Johannes Schlüter wrote: > On Wed, 2016-04-20 at 00:09 +0200, Marco Pivetta wrote: >> > In Doctrine ORM, having a way to know that a field or parameter is a >> > string | null or a int | >> > float may be the difference between >> > knowing >> > what kind of column definition is needed for a field at DB level, >> > without >> > even need for defining manual mappings. > So what's the column definition if you see string | null? > A PHP string > can have (almost) arbitrary length and binary data, so this is a BLOB? > Most likely not what the user wants. > > The PHP type hardly describes the constraints by the application. This > might add a small sanity check but by no means a game changer. String length, size of integer and accuracy of numeric all affect the definition of the schema at the DB level which adding a little twiddly bit does nothing to provide an expandable type definition. I'm not objecting to a type system per-say but even the bits that have been bodged into PHP7 already do not provide a route forward for REAL data validation? -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.internals (#92527) next »