Private static variables in php class
codeigniter, php, private-members, static
Solution
In your `product()` method you're trying to access the private member `self::$ci`. Your IDE thinks that this method can be accessed anywhere, and detects a conflict with the private static member `$ci`.
Problem
I have a few classes that are often run through `var_dump` or `print_r`. Inside these classes I have a few variables that are references to other, rather large objects that only ever has one instance of each and are only used inside the classes (outside the classes have their own reference to these classes) I do not wish these classes printed in the output, so I have declared them as `private static` which is working fine. But my IDE (PHPstorm) is flicking up an error-level alert with `Member has private access` when I access them through `self::$ci->...` I am wondering if this is a bug in the IDE, highlighting because it's probably a bug (aka it's static but nothing outside the class can access it, why would you want to to do that?), or because there is actually something syntactically wrong with it? As an example here is part of the class, Note that `=& get_instance();` returns a reference to the Code Igniter super object ``` private static $ci = null; public function __construct(){ self::$ci = self::$ci =& get_instance(); } public function product() { if ($this->product == null) { self::$ci->products->around($this->relative_date); $this->product = self::$ci->products->get($this->product_id); } return $this->product; } ```