Edit report at https://bugs.php.net/bug.php?id=62257&edit=1

 ID:                 62257
 Comment by:         ni...@php.net
 Reported by:        valentiny510 at yahoo dot es
 Summary:            Allow variables in class create
 Status:             Open
 Type:               Feature/Change Request
 Package:            Class/Object related
 Operating System:   XP
 PHP Version:        5.4.3
 Block user comment: N
 Private report:     N

 New Comment:

If you want to shorten long names make use of the namespacing support 
introduced in 5.3. Simply write

    use SomeVery\VeryLong\NameAndMore as ShortName;

and you're done. You can also do this programmatically using class_alias().


Previous Comments:
------------------------------------------------------------------------
[2012-06-08 01:20:34] valentiny510 at yahoo dot es

P.S. Not only for long names.. but also for autoloading/extending multiple 
classes.. now I let you to imaginate..

------------------------------------------------------------------------
[2012-06-08 01:08:33] valentiny510 at yahoo dot es

Description:
------------
I think may be very useful sometimes allowing the use of variables when create 
some class like this:

$class = 'test';
class $class { }

Sometimes when working with some cms/framework etc.. they have 
a_very_very_very_long_name_for some_classes and will be more easy (depends of 
situation) to have an array with shorten name. Ex:

$short_names = array (
    'short1' => 'a_very_long_name_of_some_class',
    'short2' => 'another_very_long_name');
foreach ($short_names as $short => $long)
    class $short extends $long { }
/*endforeach*/;




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62257&edit=1

Reply via email to