php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43102 Request for type hinting of class properties
Submitted: 2007-10-24 20:59 UTC Modified: 2018-05-05 19:03 UTC
Votes:29
Avg. Score:4.7 ± 0.6
Reproduced:24 of 24 (100.0%)
Same Version:14 (58.3%)
Same OS:19 (79.2%)
From: fjas at free dot fr Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.2.4 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
18 + 30 = ?
Subscribe to this entry?

 
 [2007-10-24 20:59 UTC] fjas at free dot fr
Description:
------------
PHP5 allows to type hint function parameters.
I like the possibility to have the choice, between type hinting, or not.

But it would be so nice to have the same optional behaviour with class properties...
Is it logical to allow type hinting for parameters, and not for properties ???


Expected result:
----------------
Class B {
 (...)
}

Class A {
 public B $b
 (...)
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-05-05 19:03 UTC] requinix@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2018-05-05 19:03 UTC] requinix@php.net
Considered and declined. https://wiki.php.net/rfc/typed-properties
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 20:01:30 2024 UTC