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

 ID:                 64204
 Updated by:         johan...@php.net
 Reported by:        andy at mrhunt dot co dot uk
 Summary:            Read only and write once paramater visibility
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

No, this is not easy, mind cases like this:

$test = new Test();
$foo = &$test->param_ro;
$foo = 'test';

Our current discussion state is more around accessors, while that's not yet 
accepted either: https://wiki.php.net/rfc/propertygetsetsyntax-v1.2


Previous Comments:
------------------------------------------------------------------------
[2013-02-13 15:12:33] andy at mrhunt dot co dot uk

Description:
------------
This is a hopefully simple request to add an extra visibility type into classes 
to 
allow for paramaters that can be read outside the class like with public but 
can 
only be written too inside as with protected. I've put a sample of how I think 
this should work below to hopefully give you a better idea of this.

Test script:
---------------
class Test
{
  readonly $param_ro;

  public funcion test()
  {
    $this->param_ro = 'test-ro'; // Works
  }
}
$test = new Test();

echo $test->param_ro; // Works

$this->param_ro = 'test'; // Fails



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



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

Reply via email to