Closed
Description
Currently the StaticThisUsageSniff shows an error in the following case:
<?php
class A {
static public function Test() {
return function() {
echo($this->_name . PHP_EOL);
};
}
}
class B {
protected $_name = 'Bob';
}
$closure = A::Test();
$b = new B();
$closure = $closure->bindTo($b, B::class);
$closure();
The sniff should either not error or downgrade it to a warning if the $this reference is inside a closure.