mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
minor #4814 Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access (fabpot)
This PR was merged into the 3.x branch.
Discussion
----------
Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access
The removed code was needed for `isset($closure->__invoke)` to work with PHP pre-8.0 (to avoid a fatal error):
* 7.4: Fatal error: Uncaught Error: Closure object cannot have properties
* 8.0: Fatal error: Uncaught Error: Closure object cannot have properties
* 8.1+: bool(false) clean, no error
Commits
-------
42ccc472a2 Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access
This commit is contained in:
@@ -1795,10 +1795,6 @@ final class CoreExtension extends AbstractExtension
|
||||
|
||||
static $propertyCheckers = [];
|
||||
|
||||
if ($object instanceof \Closure && '__invoke' === $item) {
|
||||
return $isDefinedTest ? true : $object();
|
||||
}
|
||||
|
||||
if (isset($object->$item)
|
||||
|| ($propertyCheckers[$object::class][$item] ??= self::getPropertyChecker($object::class, $item))($object, $item)
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user