From:             
Operating system: 
PHP version:      5.3.6
Package:          Variables related
Bug Type:         Feature/Change Request
Bug description:Type hinting for documentation

Description:
------------
Since the dawn of time the PHP documentation has contained function
declarations like this:



string strstr ( string $haystack , mixed $needle [, bool $before_needle =
false ] )



But the PHP parser does not allow this syntax. Many people have been trying
to get proper type hinting into PHP for some time now, and I appreciate
some of the problems in doing so (although it really is needed ASAP).



However, as far as I'm concerned, a good 60% of the reason for wanting type
hinting is for documentation purposes, and readability. Until the type
hinting is implemented fully, please can we at least allow the PHP parser
to accept the type hinting keywords for documentation purposes.



At the moment I'm on the verge of writing an extended PHP language with
type hinting that compiles to PHP by removing the type keywords. That's
completely insane, but the current situation leaves no choice.



Thanks.

Test script:
---------------
function int foo(bool bar, string baz) { }

Expected result:
----------------
The PHP parser should at least accept this syntax, even if it's not used
yet.

Actual result:
--------------
Parse error.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54862&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54862&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54862&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54862&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54862&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54862&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54862&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54862&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54862&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54862&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54862&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54862&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54862&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54862&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54862&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54862&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54862&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54862&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54862&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54862&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54862&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54862&r=mysqlcfg

Reply via email to