Using an object in ExpressionLanguage

Code
<?php

use Symfony\Component\ExpressionLanguage\ExpressionLanguage;

class 
Foo
{
    public function 
__construct($value)
    {
        
$this->value = (string) $value;
    }
    
    public function 
getValue()
    {
        return 
$this->value;
    }
}

$exprLang = new ExpressionLanguage();

$foo = new Foo('Bar');

$expr 'foo.getValue() ~ " is the value."';

echo 
$exprLang->evaluate($expr, array(
    
'foo' => $foo,
));
Result
Bar is the value.
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8