From:             knight at kopernet dot org
Operating system: 
PHP version:      Irrelevant
Package:          Class/Object related
Bug Type:         Feature/Change Request
Bug description:consider loosing the imposed restriction of typehints

Description:
------------
Typehints are means to introduce typesafety into PHP code which should
futher improve the code reliability and robustness.

Considering that PHP language is dynamic in nature it's difficult to
fulfill the promise completely as there's no compilation stage that
integrates calling code with the modules that might make extensive usage of
the hint.

Failing to satisfy the expectations of typehints generates a fatal error
though.
Unfortunately it can only be detected at runtime and that can be very late
when the misfortunate code path is executed - at edge case never.

The most real usage of the typehints are made by advanced IDE like Eclipse
PDT or PhpStorm which use it to provide advanced intellisense like code
completition and near compile quality static code analisis. In those
development environments similar effect can be achieved by adding a proper
phpdoc annotation block before the method signature. It's much more verbose
though and naturally a typehint is a very succinct replacement and it's
where I see the most value of the typehints.

Given the above please consider replacing the current behavior of throwing
a fatal error in case of a mismatch by just emitting a warning.


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

Reply via email to