Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Access to an undefined static property in Closure::bind
- Loading branch information
1 parent
3f712be
commit 2f2639c
Showing
3 changed files
with
65 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Bug4734; | ||
|
||
use function PHPStan\Analyser\assertType; | ||
|
||
class Foo | ||
{ | ||
/** | ||
* @var bool | ||
*/ | ||
private static $httpMethodParameterOverride = true; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
private $httpMethodParameterOverride2 = true; | ||
} | ||
|
||
class Bar | ||
{ | ||
public function test(): void | ||
{ | ||
$disableHttpMethodParameterOverride = \Closure::bind(static function (): void { | ||
static::$httpMethodParameterOverride = false; | ||
}, new Foo(), Foo::class); | ||
$disableHttpMethodParameterOverride(); | ||
|
||
$disableHttpMethodParameterOverride2 = \Closure::bind(function (): void { | ||
$this->httpMethodParameterOverride2 = false; | ||
}, new Foo(), Foo::class); | ||
$disableHttpMethodParameterOverride2(); | ||
|
||
$disableHttpMethodParameterOverride3 = \Closure::bind(function (): void { | ||
static::$httpMethodParameterOverride3 = false; | ||
}, new Foo(), Foo::class); | ||
$disableHttpMethodParameterOverride3(); | ||
|
||
$disableHttpMethodParameterOverride4 = \Closure::bind(function (): void { | ||
$this->httpMethodParameterOverride4 = false; | ||
}, new Foo(), Foo::class); | ||
$disableHttpMethodParameterOverride4(); | ||
} | ||
} |