Req #53600 [Opn->Sus]: Localised namespace importing within codeblocks

From: Date: Sat, 22 Sep 2018 17:16:46 +0000
Subject: Req #53600 [Opn->Sus]: Localised namespace importing within codeblocks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217196@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53600&edit=1

 ID:                 53600
 Updated by:         cmb@php.net
 Reported by:        ProPuke at gmail dot com
 Summary:            Localised namespace importing within codeblocks
-Status:             Open
+Status:             Suspended
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        5.3.4
 Block user comment: N
 Private report:     N

 New Comment:

This change requires the RFC process[1].  If you, or anybody else,
is still interested in this feature, feel free to start it.  For
the time being, I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>


Previous Comments:
------------------------------------------------------------------------
[2010-12-23 16:02:26] ProPuke at gmail dot com

Description:
------------
It would be nice to important an entire namespace into global space, but only for 
a controlled section of code

Test script:
---------------
/* desktop.php */
<?php

namespace desktop;

class Window{...}
class Icon{...}
class Button{...}

?>

/* index.php */
<?php

require 'desktop.php';

global_function();

{
  use desktop;

  $window1=new Window();
  $window2=new Window();
  $button1=new Button();
}

more_global_functions();

?>

Expected result:
----------------
Whilst in the codeblock the namespace is available as if it were global, but once 
outside it is no longer globally available. The global namespace should be 
unaffected afterwards

Actual result:
--------------
currently namespaces cannot be imported entirely under the justification that it 
will pollute the global namespace. I believe that if only done for controlled 
regions of code this can be avoided & code can be more cleanly written


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



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


Thread (2 messages)

« previous php.bugs (#217196) next »