-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not report unused class elements if the element is used on an unce…
…rtain type like `mixed`
- Loading branch information
1 parent
6c941ae
commit cbdb30d
Showing
7 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug9765; | ||
|
||
class HelloWorld | ||
{ | ||
|
||
public static function runner(): \Closure | ||
{ | ||
return function (int $arg) { | ||
return $this->add($arg); | ||
}; | ||
} | ||
|
||
public function do(): void | ||
{ | ||
$c = self::runner(); | ||
print $c->bindTo($this)(5); | ||
} | ||
|
||
private function add(int $a): int | ||
{ | ||
return $a + 1; | ||
} | ||
|
||
} | ||
|
||
class HelloWorld2 | ||
{ | ||
|
||
/** @var int */ | ||
private $foo; | ||
|
||
public static function runner(): \Closure | ||
{ | ||
return function (int $arg) { | ||
if ($arg > 0) { | ||
$this->foo = $arg; | ||
} else { | ||
echo $this->foo; | ||
} | ||
}; | ||
} | ||
|
||
public function do(): void | ||
{ | ||
$c = self::runner(); | ||
print $c->bindTo($this)(5); | ||
} | ||
|
||
} | ||
|
||
class HelloWorld3 | ||
{ | ||
|
||
private const FOO = 1; | ||
|
||
public static function runner(): \Closure | ||
{ | ||
return function (int $arg) { | ||
echo $this::FOO; | ||
}; | ||
} | ||
|
||
public function do(): void | ||
{ | ||
$c = self::runner(); | ||
print $c->bindTo($this)(5); | ||
} | ||
|
||
} |