CoreFiles by mySites.guru
ExpressionLanguageProvider.php28 lines, 1,028 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
794aad5364803c33201c27c8ed9cf3c3
sha1
107613a1115ee3e0520eff68b0d9bf6ba04ecd14
sha256
ec6e6548e964d8bdb8168497e1e3cac798632e62eb57b700769e893910dd1c6f
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator\Constraints;

use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;

class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
    public function getFunctions(): array
    {
        return [
            new ExpressionFunction('is_valid', static fn (...$arguments) => \sprintf(
                '0 === $context->getValidator()->inContext($context)->validate(%s)->getViolations()->count()',
                implode(', ', $arguments)
            ), static fn (array $variables, ...$arguments) => 0 === $variables['context']->getValidator()->inContext($variables['context'])->validate(...$arguments)->getViolations()->count()),
        ];
    }
}

The same content is in 12 releases, Joomla 5.4.11 to 6.3.0-alpha1. See them all, or every version of this file.