Ignore static properties when using the dot operator

This commit is contained in:
Nicolas Grekas
2025-01-22 09:07:59 +01:00
parent 4f3770ea78
commit 1d5180549f
3 changed files with 4 additions and 1 deletions
+1
View File
@@ -4,6 +4,7 @@
* Add the `invoke` filter
* Make `{}` optional for the `types` tag
* Add `LastModifiedExtensionInterface` and implementation in `AbstractExtension` to track modification of runtime classes
* Ignore static properties when using the dot operator
# 3.18.0 (2024-12-29)
+1 -1
View File
@@ -2151,7 +2151,7 @@ final class CoreExtension extends AbstractExtension
$property = $class->getProperty($property);
if (!$property->isPublic()) {
if (!$property->isPublic() || $property->isStatic()) {
static $false;
return $false ??= static fn () => false;
+2
View File
@@ -67,6 +67,8 @@ class TwigTestFoo implements \Iterator
public $position = 0;
public $array = [1, 2];
public static $foo = 'Foo';
public function bar($param1 = null, $param2 = null)
{
return 'bar'.($param1 ? '_'.$param1 : '').($param2 ? '-'.$param2 : '');