Req #71723 [NEW]: Ability to create internal classes/functions
| From: | untuned20 at gmail dot com | Date: | Sun, 06 Mar 2016 15:59:07 +0000 |
| Subject: | Req #71723 [NEW]: Ability to create internal classes/functions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-199630@lists.php.net to get a copy of this message | ||
From: untuned20 at gmail dot com
Operating system:
PHP version: Irrelevant
Package: *Programming Data Structures
Bug Type: Feature/Change Request
Bug description:Ability to create internal classes/functions
Description:
------------
The ability to make classes/functions "internal" which would make them
only instantiatable and/or callable from within the current root
namespace.
This would be helpful when creating a library where you only want
classes to be available to other classes within the library. As to
someone using the library they wouldn't be able to initiate the class in
the library or use it outside of the namespace.
Test script:
---------------
namespace RootSpace\SubSpace;
internal class TestClass {}
---
namespace RootSpace\OtherSpace;
use RootSpace\SubSpace\TestClass;
class AnotherClass {
public function test(){
$class = new TestClass();
}
}
---
namespace MySpace;
use RootSpace\SubSpace\TestClass;
class MyClass {
public function test(){
$class = new TestClass();
}
}
Expected result:
----------------
"AnotherClass" should create an instance of TestClass it
"AnotherClass::test()" is called because they share the same root space
"RootSpace".
"MyClass" should throw an error when "MyClass::test()" is called because
it isn't in the root space "RootSpace"
--
Edit bug report at https://bugs.php.net/bug.php?id=71723&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71723&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71723&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71723&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71723&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71723&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71723&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71723&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71723&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71723&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71723&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71723&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71723&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71723&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71723&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71723&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71723&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71723&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71723&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71723&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71723&r=mysqlcfg