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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Tue Apr 16 19:01:31 2024 UTC