<?php
/**
* @mixin B
*/
trait Bug {
function test() {
$this->foo();
echo $this->bar; // Member has private visibility and is not accessible from the current context.PHP(PHP1416)
}
}
class B {
use Bug;
private int $bar = 1;
public function foo() {
}
}
(new B)->test();
Related bug: When trait and @mixin are in the vendor, it will not autocomplete or display hover about the private/protected properties of the mixed-in class.
Related bug: When trait and
@mixin
are in thevendor
, it will not autocomplete or display hover about the private/protected properties of the mixed-in class.