| Summary: | PHP parser shows an error on valid type hinting usage | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Alexander <ashaduri> |
| Component: | Language Support: PHP | Assignee: | kdevelop-bugs-null |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | niko.sams, pprkut |
| Priority: | NOR | ||
| Version First Reported In: | git master | ||
| Target Milestone: | --- | ||
| Platform: | Unlisted Binaries | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | 5.3.0 | |
| Sentry Crash Report: | |||
confirmed. Not so easy to fix as the default arguments in FunctionDeclaration don't support that. Php sucks! This was fixed in https://cgit.kde.org/kdev-php.git/commit/?id=4b10347f367cf1224829fd9ae6ae9f4f07fc54bd and works with kdev-php 5.2 @Heinz: Patch is in master only though. So the fixed version is 5.3.0 (unreleased atm). Sorry, checked the wrong branch. It's indeed in master only |
Version: SVN (using KDE 4.4.3) OS: Linux I'm using KDevelop & friends git master (2010-06-14). The following code inhibits an error: class A { } function func(A $a = NULL, array $b = NULL, $c) // $c is highlighted as an error { print $c; } The "A $a = NULL" part means that $a can be an instance of A, or NULL. Without "= NULL" only an instance of A would be accepted. Same for "array $b = NULL". See more at http://www.php.net/manual/en/language.oop5.typehinting.php . KDevelop assumes that if a parameter has a default value, all the following parameters must also have ones, which is incorrect in this case. Thanks Reproducible: Always Expected Results: Type-hinted parameters with default values should not cause the following parameters without default values to be treated like errors. openSUSE 11.1 x86_64.