Re: [RFC] Scalar Type Hints v0.2

From: Date: Wed, 14 Jan 2015 10:20:00 +0000
Subject: Re: [RFC] Scalar Type Hints v0.2
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-80454@lists.php.net to get a copy of this message
Hi Thomas, > On 14 Jan 2015, at 10:08, Thomas Nunninger <thomas@nunninger.info> wrote: > > ---------------- > $i = 1; > $a = myFunc( $i ); > > declare(strict_typehints=TRUE); > > function myFunc( float $f ) > { > return otherFunc( $f ); > } > > function otherFunc( float $f ) > { > ... > } > ---------------- > > As author of strict code I need to replace > > return otherFunc( $f ); > > by > > return otherFunc( (float) $f ); > > > I'm not sure > > - if this is what a strict coder wants and > > - if you find an acceptable way to test your strict code if it works with non-strict code. I don’t understand, I’m sorry. If you are using declare(strict_typehints=TRUE); then all calls in a file are “strict”. If you are not, all calls in a file are “weak”. -- Andrea Faulds http://ajf.me/

« previous php.internals (#80454) next »