On Fri, Oct 11, 2019, at 8:54 AM, Nikita Popov wrote: > Hi internals, > > Something I've seen play out a couple of times: Newbies try to use > something like "integer" or "resource" as a type, and then get a confusing > error message along the lines of "must be an instance of resource, resource > given". > > I would like to throw a compiler warning in this case, that looks as one of > the following: > > > Warning: "integer" will be interpreted as a class type. Did you mean > "int"? Use qualified name or "use" to suppress this warning > > > Warning: "resource" is not a supported builtin type and will be > interpreted as a class type. Use qualified name or "use" to suppress this > warning > > This warning only triggers if the type is lowercase (integer but not > Integer), is unqualified (integer but not \integer) and is not imported > (there is no "use integer"). This provides multiple ways to avoid the > warning for code that does legitimately want to use lowercase "integer" as > a class type. > > Implementation: https://github.com/php/php-src/pull/4815 > > Thoughts? > > Nikita
Can you clarify where exactly "compiler warning" would be displayed? Is that an E_WARNING? How would I as a user see a message when I write function foo(integer $a) { ... } --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php