|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #68876 Access specifier for class
Submitted: 2015-01-21 14:13 UTC Modified: 2017-08-05 04:53 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: kulinchoksi at gmail dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 5.6.4 OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-01-21 14:13 UTC] kulinchoksi at gmail dot com
From manual page:

In recent versions of PHP, we have introduced feature of namespaces.

I was thinking of the scenario where we can specify access specifier/visibility of classes also.

We may allow to access instantiation of the class inside namespace only if it's private.
Although I'm not sure about allowing the objects of that class outside the namespace but I think, it should be allowed in any case.

Example of encapsulating classes in namespace could be:
- Different payment classes may represent different payment methods.
- A payment manager class can only access the payment factory which will decide to instantiate particular type of payment class.
- In application, we would access payment class via manager class only. So manager class can behave like a public interface of payment entities.


namespace application/payment;

abstract class Payment {

private class TypePaypal extends Payment {

private class TypePaymentInAdvance extends Payment {

class PaymentFactory {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-21 14:35 UTC]
-Package: PHP Language Specification +Package: *General Issues
 [2015-02-24 23:10 UTC] edgar dot r dot sandi at gmail dot com
I think that you maybe is asking by:

I'm right?

cross your fingers!

 [2017-08-05 04:53 UTC]
-Status: Open +Status: Suspended
 [2017-08-05 04:53 UTC]
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals list ( as an RFC. Please read the guide about creating RFCs here:
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the Internals list ( and/or solicit help from one of the experienced developers. 

Please to not consider this comment as a negative view on the merits of your proposal - every proposal which requires changes of certain magnitude, even the very successful and widely supported ones, must be done through the RFC process. This helps make the process predictable, transparent and accessible to all developers.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 19:03:33 2021 UTC