prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
ent\DependencyInjection\Container; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\SessionFactory; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorageFactory...
d; $request = new Request(); $request->cookies->set($sessionName, $sessionId); $requestStack = new RequestStack(); $requestStack->push($request); $sessionFactory = new SessionFactory($requestStack, new NativeSessionStorageFactory()); $container = new C
nt\HttpKernel\HttpKernelInterface; /** @var Response $r */ $r = require __DIR__.'/common.inc'; $sessionId = 'vqd4dpbtst3af0k4sdl18nebkn'; session_id($sessionId); $sessionName = session_name(); $_COOKIE[$sessionName] = $sessionI
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/deleted_cookie.php", "language": "php", "file_size": 1845, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Attribute; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation...
'a' => '1234', 'b' => '4321', ], 'category' => [ 'fishing' => [ 'first' => 'cod', 'second' => 'sole', ], ], ];
ributeBag $bag = null; protected function setUp(): void { $this->array = [ 'hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', 'csrf.token' => [
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php", "language": "php", "file_size": 5001, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\...
tialize($this->array); } public function testInitialize() { $sessionMetadata = []; $bag1 = new MetadataBag(); $bag1->initialize($sessionMetadata); $this->assertGreaterThanOrEqual(time(), $bag1->getCreated());
; protected function setUp(): void { $this->bag = new MetadataBag(); $this->array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0]; $this->bag->ini
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php", "language": "php", "file_size": 4298, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Comp...
_temp_dir().'/sftest'; $this->storage = $this->getStorage(); } protected function tearDown(): void { array_map('unlink', glob($this->sessionDir.'/*')); if (is_dir($this->sessionDir)) { @rmdir($this->sessionD
k@zikula.org> */ class MockFileSessionStorageTest extends TestCase { protected MockFileSessionStorage $storage; private string $sessionDir; protected function setUp(): void { $this->sessionDir = sys_get
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php", "language": "php", "file_size": 3771, "cut_index": 614, "middle_length": 229 }
eProcesses; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handle...
private string $savePath; private $initialSessionSaveHandler; private $initialSessionSavePath; protected function setUp(): void { $this->initialSessionSaveHandler = ini_set('session.save_handler', 'files'); $this->initi
ass for NativeSessionStorage. * * @author Drak <drak@zikula.org> * * These tests require separate processes. */ #[RunTestsInSeparateProcesses] #[PreserveGlobalState(false)] class NativeSessionStorageTest extends TestCase {
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php", "language": "php", "file_size": 11222, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpFoundation\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\ServerBag; /** * ServerBagTest. * * @author Bulat Shakirzyanov <mallluhuct@gmail.com> */ class ServerBagTest extends TestCase { public function testShouldExt...
$server); $this->assertEquals([ 'CONTENT_TYPE' => 'text/html', 'CONTENT_LENGTH' => '0', 'ETAG' => 'asdf', 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), 'PHP_AUTH_USER' => 'foo',
'HTTP_CONTENT_TYPE' => 'text/html', 'HTTP_CONTENT_LENGTH' => '0', 'HTTP_ETAG' => 'asdf', 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', ]; $bag = new ServerBag(
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php", "language": "php", "file_size": 6413, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\Attributes\PreserveGlobalState; use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; u...
private string $savePath; private $initialSessionSaveHandler; private $initialSessionSavePath; protected function setUp(): void { $this->initialSessionSaveHandler = ini_set('session.save_handler', 'files'); $this->init
lass for PhpSessionStorage. * * @author Drak <drak@zikula.org> * * These tests require separate processes. */ #[PreserveGlobalState(false)] #[RunTestsInSeparateProcesses] class PhpBridgeSessionStorageTest extends TestCase {
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php", "language": "php", "file_size": 3127, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; use PHPUnit\Framework\Attributes\PreserveGlobalState; use PH...
p(): void { $this->proxy = new class extends AbstractProxy {}; } public function testGetSaveHandlerName() { $this->assertNull($this->proxy->getSaveHandlerName()); } public function testIsSessionHandlerInterface()
Session\Storage\Proxy\SessionHandlerProxy; /** * Test class for AbstractProxy. * * @author Drak <drak@zikula.org> */ class AbstractProxyTest extends TestCase { protected AbstractProxy $proxy; protected function setU
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php", "language": "php", "file_size": 2741, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RateLimiter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Reque...
LimiterInterface::class); $limiter->method('consume')->willReturn($rateLimit); return $limiter; }, $rateLimits)); $this->assertSame($expected, $rateLimiter->consume(new Request())); } public function testC
its')] public function testConsume(array $rateLimits, ?RateLimit $expected) { $rateLimiter = new MockAbstractRequestRateLimiter(array_map(function (RateLimit $rateLimit) { $limiter = $this->createStub(
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RateLimiter/AbstractRequestRateLimiterTest.php", "language": "php", "file_size": 3053, "cut_index": 614, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Framework\Attrib...
estMatcher([$key => $regexp]); $request = Request::create('/admin/foo'); $request->attributes->set('foo', 'foo_bar'); $request->attributes->set('_controller', static fn () => new Response('foo')); $this->assertSame($expected
nent\HttpFoundation\Response; class AttributesRequestMatcherTest extends TestCase { #[DataProvider('getData')] public function test(string $key, string $regexp, bool $expected) { $matcher = new AttributesRequ
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/AttributesRequestMatcherTest.php", "language": "php", "file_size": 1345, "cut_index": 524, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Framework\Attributes\DataProv...
uest::create('', $requestMethod); $this->assertSame($isMatch, $matcher->matches($request)); } public function testAlwaysMatchesOnEmptyMethod() { $matcher = new MethodRequestMatcher([]); $request = Request::create('https
tends TestCase { #[DataProvider('getData')] public function test(string $requestMethod, array|string $matcherMethod, bool $isMatch) { $matcher = new MethodRequestMatcher($matcherMethod); $request = Req
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/MethodRequestMatcherTest.php", "language": "php", "file_size": 1536, "cut_index": 537, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Fram...
, [], ['HTTP_HOST' => null, 'SERVER_PORT' => 8000]); $this->assertSame($expected, $matcher->matches($request)); } public static function getData() { return [ [8000, true], [9000, false], ]; }
RequestMatcherTest extends TestCase { #[DataProvider('getData')] public function test(int $port, bool $expected) { $matcher = new PortRequestMatcher($port); $request = Request::create('', 'get', [], []
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/PortRequestMatcherTest.php", "language": "php", "file_size": 1000, "cut_index": 512, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Flash; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag; /**...
(): void { unset($this->bag); } public function testInitialize() { $bag = new FlashBag(); $array = ['new' => ['notice' => ['A previous flash message']]]; $bag->initialize($array); $this->assertEquals
function setUp(): void { $this->bag = new FlashBag(); $this->array = ['new' => ['notice' => ['A previous flash message']]]; $this->bag->initialize($this->array); } protected function tearDown
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php", "language": "php", "file_size": 4457, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Comp...
unction setUp(): void { $this->attributes = new AttributeBag(); $this->flashes = new FlashBag(); $this->data = [ $this->attributes->getStorageKey() => ['foo' => 'bar'], $this->flashes->getStorageKey() =>
rak@zikula.org> */ class MockArraySessionStorageTest extends TestCase { private MockArraySessionStorage $storage; private AttributeBag $attributes; private FlashBag $flashes; private array $data; protected f
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php", "language": "php", "file_size": 3342, "cut_index": 614, "middle_length": 229 }
public function testSend() { $response = new Response(); $responseSend = $response->send(); $this->assertSame($response, $responseSend); } public function testGetCharset() { $response = new Response(); $charsetOrigin = 'utf-8'; $response->setCharset($ch...
public function testIsCacheableWithNoStoreDirective() { $response = new Response(); $response->headers->set('cache-control', 'private'); $this->assertFalse($response->isCacheable()); } public function testIsCacheab
onse(); $this->assertFalse($response->isCacheable()); } public function testIsCacheableWithErrorCode() { $response = new Response('', 500); $this->assertFalse($response->isCacheable()); }
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php", "language": "php", "file_size": 42293, "cut_index": 2151, "middle_length": 229 }
st extends TestCase { public function testResponseSimpleList() { $content = $this->createSendResponse( [ '_embedded' => [ 'articles' => $this->generatorSimple('Article'), 'news' => $this->generatorSimple('News'), ], ...
ponseNestedGenerator() { $content = $this->createSendResponse((function (): iterable { yield 'articles' => $this->generatorSimple('Article'); yield 'news' => $this->generatorSimple('News'); })()); $this-
estResponseSimpleGenerator() { $content = $this->createSendResponse($this->generatorSimple('Article')); $this->assertSame('["Article 1","Article 2","Article 3"]', $content); } public function testRes
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/StreamedJsonResponseTest.php", "language": "php", "file_size": 9343, "cut_index": 921, "middle_length": 229 }
ny\Component\HttpFoundation\Exception\ExpiredSignedUriException; use Symfony\Component\HttpFoundation\Exception\LogicException; use Symfony\Component\HttpFoundation\Exception\UnsignedUriException; use Symfony\Component\HttpFoundation\Exception\UnverifiedSignedUriException; use Symfony\Component\HttpFoundation\Request; ...
ContainsString('&foo=', $signer->sign('http://example.com/foo?foo=bar')); $this->assertStringContainsString('?_expiration=', $signer->sign('http://example.com/foo', 1)); $this->assertStringContainsString('&_hash=', $signer->sign('http://ex
); $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo')); $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo?foo=bar')); $this->assertString
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/UriSignerTest.php", "language": "php", "file_size": 12807, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framewor...
oreach ($headers as $k => $v) { $request->headers->set($k, $v); } $this->assertSame($matches, $matcher->matches($request)); } #[DataProvider('getDataForArray')] public function testCommaSeparatedString(array $heade
aProvider('getDataForArray')] public function testArray(array $headers, bool $matches) { $matcher = new HeaderRequestMatcher(['x-foo', 'bar']); $request = Request::create('https://example.com'); f
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/HeaderRequestMatcherTest.php", "language": "php", "file_size": 2741, "cut_index": 563, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Framework\Attrib...
=> '127.0.0.1']); $this->assertSame($expected, $matcher->matches($request)); } public static function getData() { return [ [[], true], ['127.0.0.1', true], ['192.168.0.1', false],
Test extends TestCase { #[DataProvider('getData')] public function test($ips, bool $expected) { $matcher = new IpsRequestMatcher($ips); $request = Request::create('', 'GET', [], [], [], ['REMOTE_ADDR'
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/IpsRequestMatcherTest.php", "language": "php", "file_size": 1422, "cut_index": 524, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session\Flash; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; /** * FlashBagTest. * ...
public function testInitialize() { $bag = new FlashBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $bag->peekAll()); $array = ['should' => ['change']]; $bag->initialize($array); $
s->bag = new FlashBag(); $this->array = ['notice' => ['A previous flash message']]; $this->bag->initialize($this->array); } protected function tearDown(): void { unset($this->bag); }
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php", "language": "php", "file_size": 4623, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; abstract class ResponseTestCase extends TestCase { ...
ment; filename="fname.ext"'); $response->prepare($request); $this->assertFalse($response->headers->has('Cache-Control')); // Check for IE 10 and HTTPS $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE
); $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'); $response = $this->provideResponse(); $response->headers->set('Content-Disposition', 'attach
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/ResponseTestCase.php", "language": "php", "file_size": 3409, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\RequestMatcher; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framewor...
HTTPS' => 'on']); $matcher = new SchemeRequestMatcher($matcherScheme); if ($isMatch) { if ('https' === $requestScheme) { $this->assertFalse($matcher->matches($httpRequest)); $this->assertTrue($ma
aProvider('getData')] public function test(string $requestScheme, array|string $matcherScheme, bool $isMatch) { $httpRequest = Request::create(''); $httpsRequest = Request::create('', 'get', [], [], [], ['
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/RequestMatcher/SchemeRequestMatcherTest.php", "language": "php", "file_size": 2043, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\HttpFoundation\Tests\Session; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Compon...
torage\SessionStorageInterface; /** * SessionTest. * * @author Fabien Potencier <fabien@symfony.com> * @author Robert Schönthal <seroscho@googlemail.com> * @author Drak <drak@zikula.org> */ class SessionTest extends TestCase { protected SessionS
tpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\S
{ "filepath": "src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php", "language": "php", "file_size": 7982, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; u...
es($other): bool { if (!$other instanceof Response) { return false; } $location = $other->headers->get('Location'); if (null === $location) { return false; } return $this->toFul
Request $request, private string $expectedValue) { } public function toString(): string { return \sprintf('has header "Location" matching "%s"', $this->expectedValue); } protected function match
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHeaderLocationSame.php", "language": "php", "file_size": 1632, "cut_index": 537, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\Security\Co...
cks if the plaintext password matches the user's password. */ public function isPasswordValid(PasswordAuthenticatedUserInterface $user, #[\SensitiveParameter] string $plainPassword): bool; /** * Checks if an encoded password would benefi
nterface { /** * Hashes the plain password for the given user. */ public function hashPassword(PasswordAuthenticatedUserInterface $user, #[\SensitiveParameter] string $plainPassword): string; /** * Che
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/UserPasswordHasherInterface.php", "language": "php", "file_size": 1109, "cut_index": 515, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Exception\InvalidArgumentException; use Symfony\Component\Validator\Exception\InvalidOptionsException; /** * Contains the properties of a constraint definition. * * A constraint can be defined on a class, a pro...
EFAULT_GROUP = 'Default'; /** * Marks a constraint that can be put onto classes. */ public const CLASS_CONSTRAINT = 'class'; /** * Marks a constraint that can be put onto properties. */ public const PROPERTY_CONSTRAINT
re immutable and serializable. * * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class Constraint { /** * The name of the group given to all constraints with no explicit group. */ public const D
{ "filepath": "src/Symfony/Component/Validator/Constraint.php", "language": "php", "file_size": 5935, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Base class for constraint validators. * * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class ConstraintValidator implements ConstraintValidatorInterface ...
array $initializeOverrideCache = []; protected ExecutionContextInterface $context; public function validateInContext(mixed $value, Constraint $constraint, ExecutionContextInterface $context): void { $oldContext = $this->context ?? nul
nst PRETTY_DATE = 1; /** * Whether to cast objects with a "__toString()" method to strings. */ public const OBJECT_TO_STRING = 2; /** * @var array<class-string<self>, bool> */ private static
{ "filepath": "src/Symfony/Component/Validator/ConstraintValidator.php", "language": "php", "file_size": 6367, "cut_index": 716, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Constraints\Expr...
c function __construct( protected array $validators = [], ) { } public function getInstance(Constraint $constraint): ConstraintValidatorInterface { if ('validator.expression' === $name = $class = $constraint->validatedBy())
e class name of the ConstraintValidator that * should validate the Constraint. * * @author Bernhard Schussek <bschussek@gmail.com> */ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { publi
{ "filepath": "src/Symfony/Component/Validator/ConstraintValidatorFactory.php", "language": "php", "file_size": 1132, "cut_index": 518, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * @author Bernhard Schussek <bschussek@...
d since Symfony 8.1, use "validateInContext()" instead */ public function initialize(ExecutionContextInterface $context): void; /** * Checks if the passed value is valid. * * @deprecated since Symfony 8.1, use "validateInContex
s the constraint validator. * * @deprecate
{ "filepath": "src/Symfony/Component/Validator/ConstraintValidatorInterface.php", "language": "php", "file_size": 987, "cut_index": 582, "middle_length": 52 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; /** * Default implementation of {@ConstraintViolationInterface}. * * @author Bernhard Schussek <bschussek@gmail.com> */ class ConstraintViol...
raw violation message * @param mixed $root The value originally passed to the * validator * @param string|null $propertyPath The property path from the root
a stringable object * @param string|null $messageTemplate The raw violation message * @param array $parameters The parameters to substitute in the *
{ "filepath": "src/Symfony/Component/Validator/ConstraintViolation.php", "language": "php", "file_size": 3954, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; /** * A violation of a constraint that happened during validation. * * For each constraint that fails during validation one or more violation...
e" property, the generated violation has the <tt>Person</tt> * instance as root and the property path "firstName". If validation fails * for the "street" property of the related <tt>Address</tt> instance, the root * element is still the person, but the
r example, take the following graph: * * (Person)---(firstName: string) * \ * (address: Address)---(street: string) * * If the <tt>Person</tt> object is validated and validation fails for the * "firstNam
{ "filepath": "src/Symfony/Component/Validator/ConstraintViolationInterface.php", "language": "php", "file_size": 4393, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Exception\OutOfBoundsException; /** * Default implementation of {@ConstraintViolationListInterface}. * * @au...
iolationInterface> $violations The constraint violations to add to the list */ public function __construct(iterable $violations = []) { foreach ($violations as $violation) { $this->add($violation); } } publ
ViolationListInterface { /** * @var list<ConstraintViolationInterface> */ private array $violations = []; /** * Creates a new constraint violation list. * * @param iterable<mixed, ConstraintV
{ "filepath": "src/Symfony/Component/Validator/ConstraintViolationList.php", "language": "php", "file_size": 3642, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Exception\OutOfBoundsException; /** * A list of constraint ...
nds \Traversable, \Countable, \ArrayAccess { /** * Adds a constraint violation to this list. */ public function add(ConstraintViolationInterface $violation): void; /** * Merges an existing violation list into this list. */
* @method static findByCodes(string|string[] $codes) Returns a new instance with violations matching the given error codes. Not implementing it is deprecated since Symfony 8.1. */ interface ConstraintViolationListInterface exte
{ "filepath": "src/Symfony/Component/Validator/ConstraintViolationListInterface.php", "language": "php", "file_size": 2020, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Psr\Container\ContainerInterface; use Symfony\Component\Validat...
) { $this->validators = []; } /** * @throws ValidatorException When the validator class does not exist * @throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface */ p
th <kris@symfony.com> */ class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { private array $validators; public function __construct( private ContainerInterface $container,
{ "filepath": "src/Symfony/Component/Validator/ContainerConstraintValidatorFactory.php", "language": "php", "file_size": 1960, "cut_index": 537, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator; use Symfony\Component\Validator\Exception\ValidationFailedException; use Symfony\Component\Va...
ValidCallable($constraintOrValidator, ...$constraints); return static function ($value) use ($validator) { if (!$validator($value, $violations)) { throw new ValidationFailedException($value, $violations); }
a callable chain of constraints. */ public static function createCallable(Constraint|ValidatorInterface|null $constraintOrValidator = null, Constraint ...$constraints): callable { $validator = self::createIs
{ "filepath": "src/Symfony/Component/Validator/Validation.php", "language": "php", "file_size": 2588, "cut_index": 563, "middle_length": 229 }
tFactory; use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\Mapping\Loader\AttributeLoader; use Symfony\Component\Validator\Ma...
tracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorTrait; // Help opcache.preload discover always-needed symbols class_exists(TranslatorInterface::class); class_exist
ping\Loader\XmlFileLoader; use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; use Symfony\Component\Validator\Validator\RecursiveValidator; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Con
{ "filepath": "src/Symfony/Component/Validator/ValidatorBuilder.php", "language": "php", "file_size": 12924, "cut_index": 921, "middle_length": 229 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Exception; use Symfony\Component\Validator\ConstraintViolati...
ce $violations, ) { parent::__construct($violations); } public function getValue(): mixed { return $this->value; } public function getViolations(): ConstraintViolationListInterface { return $this->viola
alue, private ConstraintViolationListInterfa
{ "filepath": "src/Symfony/Component/Validator/Exception/ValidationFailedException.php", "language": "php", "file_size": 852, "cut_index": 529, "middle_length": 52 }
buted with this source code. */ namespace Symfony\Component\Validator\Context; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Compon...
lidator\Violation\ConstraintViolationBuilder; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** * The context used and created by {@link ExecutionContextFactory}. *
\Mapping\PropertyMetadataInterface; use Symfony\Component\Validator\Util\PropertyPath; use Symfony\Component\Validator\Validator\LazyProperty; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Va
{ "filepath": "src/Symfony/Component/Validator/Context/ExecutionContext.php", "language": "php", "file_size": 7563, "cut_index": 716, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Context; use Symfony\Component\Validator\Val...
n = null, ) { } public function createContext(ValidatorInterface $validator, mixed $root): ExecutionContextInterface { return new ExecutionContext( $validator, $root, $this->translator,
* * @internal */ class ExecutionContextFactory implements ExecutionContextFactoryInterface { public function __construct( private TranslatorInterface $translator, private string|false|null $translationDomai
{ "filepath": "src/Symfony/Component/Validator/Context/ExecutionContextFactory.php", "language": "php", "file_size": 1045, "cut_index": 513, "middle_length": 229 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Context; use Symfony\Component\Validator\Validator\ValidatorInterface; /** *...
nterface ExecutionContextFactoryInterface { /** * Creates a new execution context. * * @param mixed $root The root value of the validated * object graph */ public function createContext(ValidatorInterface
author Bernhard Schussek <bschussek@gmail.com> */ i
{ "filepath": "src/Symfony/Component/Validator/Context/ExecutionContextFactoryInterface.php", "language": "php", "file_size": 911, "cut_index": 547, "middle_length": 52 }
omponent\Validator\Mapping; use Symfony\Component\Validator\Mapping\MetadataInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; /** * The context of a validation run. * * The context collects all violations generated...
idator(); * * // The violations are not added to $this->context * $violations = $validator->validate($value); * } * * However, if you want to add the violations to the current context, use the * {@link ValidatorInterface::inConte
ator, while the validation is in * progress, the violations will be isolated from each other: * * public function validate(mixed $value, Constraint $constraint): void * { * $validator = $this->context->getVal
{ "filepath": "src/Symfony/Component/Validator/Context/ExecutionContextInterface.php", "language": "php", "file_size": 10799, "cut_index": 921, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Attribute; /** * Declares that constraints...
em). * * @author Nicolas Grekas <p@tchwork.com> */ #[\Attribute(\Attribute::TARGET_CLASS)] final class ExtendsValidationFor { /** * @param class-string $class */ public function __construct( public string $class, ) { }
rily all of th
{ "filepath": "src/Symfony/Component/Validator/Attribute/ExtendsValidationFor.php", "language": "php", "file_size": 784, "cut_index": 512, "middle_length": 14 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\DataCollector; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\...
rDumper\Cloner\Stub; /** * @author Maxime Steinhausser <maxime.steinhausser@gmail.com> * * @final */ class ValidatorDataCollector extends DataCollector implements LateDataCollectorInterface { public function __construct( private TraceableV
use Symfony\Component\Validator\Validator\TraceableValidator; use Symfony\Component\VarDumper\Caster\Caster; use Symfony\Component\VarDumper\Caster\ClassStub; use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\Va
{ "filepath": "src/Symfony/Component/Validator/DataCollector/ValidatorDataCollector.php", "language": "php", "file_size": 2856, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Util; /** * Contains utility methods for dealing with property path...
property path. * * If the base path is empty, the appended path will be returned unchanged. * If the base path is not empty, and the appended path starts with a * squared opening bracket ("["), the concatenation of the two paths is
. The same behavior is also available via * {@see \Symfony\Component\PropertyAccess\PropertyPath::append()}. * * @author Bernhard Schussek <bschussek@gmail.com> */ class PropertyPath { /** * Appends a path to a given
{ "filepath": "src/Symfony/Component/Validator/Util/PropertyPath.php", "language": "php", "file_size": 1687, "cut_index": 537, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\PropertyAccess\PropertyAccess; us...
xed $value = null; public ?string $propertyPath = null; public function __construct(mixed $value = null, ?string $propertyPath = null, ?string $message = null, ?array $groups = null, mixed $payload = null) { parent::__construct(null, $
e comparison of values. * * @author Daniel Holmes <daniel@danielholmes.org> * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class AbstractComparison extends Constraint { public string $message; public mi
{ "filepath": "src/Symfony/Component/Validator/Constraints/AbstractComparison.php", "language": "php", "file_size": 2002, "cut_index": 537, "middle_length": 229 }
* * 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\Clock\ClockInterface; use Symfony\Component\Clock\DatePoint; use Symfony\Component\PropertyAccess\Exception\No...
Exception\UnexpectedTypeException; /** * Provides a base class for the validation of property comparisons. * * @author Daniel Holmes <daniel@danielholmes.org> * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class AbstractComparisonValid
PropertyAccessorInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\
{ "filepath": "src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php", "language": "php", "file_size": 4309, "cut_index": 614, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint...
array|Constraint $constraints = []; /** * @param array<Constraint>|Constraint|null $constraints * @param string[]|null $groups */ public function __construct(array|Constraint|null $constraints = null, ?array $gr
s to each element of the array. * * @author Bernhard Schussek <bschussek@gmail.com> */ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class All extends Composite { public
{ "filepath": "src/Symfony/Component/Validator/Constraints/All.php", "language": "php", "file_size": 1472, "cut_index": 524, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint...
throw new UnexpectedTypeException($constraint, All::class); } if (null === $value) { return; } if (!\is_array($value) && !$value instanceof \Traversable) { throw new UnexpectedValueExcep
** * @author Bernhard Schussek <bschussek@gmail.com> */ class AllValidator extends ConstraintValidator { public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof All) {
{ "filepath": "src/Symfony/Component/Validator/Constraints/AllValidator.php", "language": "php", "file_size": 1308, "cut_index": 524, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; use Symfony\Component\Validator\Excep...
[ self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR', ]; public array|Constraint $constraints = []; public string $message = 'This value should satisfy at least one of the following constraints:'; public string $messageCollect
:TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class AtLeastOneOf extends Composite { public const AT_LEAST_ONE_OF_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c'; protected const ERROR_NAMES =
{ "filepath": "src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php", "language": "php", "file_size": 2623, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; use Symfony\Component\Validator\Const...
} $validator = $this->context->getValidator(); // Build a first violation to have the base message of the constraint translated $baseMessageContext = clone $this->context; $baseMessageContext->buildViolation($cons
traintValidator { public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof AtLeastOneOf) { throw new UnexpectedTypeException($constraint, AtLeastOneOf::class);
{ "filepath": "src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php", "language": "php", "file_size": 2574, "cut_index": 563, "middle_length": 229 }
* * 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\Intl\Countries; use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\Validator\Constrain...
| \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class Bic extends Constraint { public const VALIDATION_MODE_STRICT = 'strict'; public const VALIDATION_MODE_CASE_INSENSITIVE = 'case-insensitive'; public const VALIDATION_MODES = [
xception; /** * Ensures that the value is valid against the BIC format. * * @see https://en.wikipedia.org/wiki/ISO_9362 * * @author Michael Hirschler <michael.vhirsch@gmail.com> */ #[\Attribute(\Attribute::TARGET_PROPERTY
{ "filepath": "src/Symfony/Component/Validator/Constraints/Bic.php", "language": "php", "file_size": 4537, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Intl\Countries; use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; use Symfony\Component\PropertyAccess\Property...
ion; /** * @author Michael Hirschler <michael.vhirsch@gmail.com> * * @see https://en.wikipedia.org/wiki/ISO_9362#Structure */ class BicValidator extends ConstraintValidator { // Reference: https://www.iban.com/structure private const BIC_COUNT
Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\LogicException; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueExcept
{ "filepath": "src/Symfony/Component/Validator/Constraints/BicValidator.php", "language": "php", "file_size": 6368, "cut_index": 716, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint...
const ERROR_NAMES = [ self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR', ]; public string $message = 'This value should be blank.'; /** * @param string[]|null $groups */ public function __construct(?array $options = null, ?stri
m> */ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class Blank extends Constraint { public const NOT_BLANK_ERROR = '183ad2de-533d-4796-a439-6d3c3852b549'; protected
{ "filepath": "src/Symfony/Component/Validator/Constraints/Blank.php", "language": "php", "file_size": 1402, "cut_index": 524, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\C...
nt, Blank::class); } if ('' !== $value && null !== $value) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Blank::NOT_BL
lass BlankValidator extends ConstraintValidator { public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof Blank) { throw new UnexpectedTypeException($constrai
{ "filepath": "src/Symfony/Component/Validator/Constraints/BlankValidator.php", "language": "php", "file_size": 1063, "cut_index": 515, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Cons...
ck The callback definition * @param string[]|null $groups */ public function __construct(string|callable|null $callback = null, ?array $groups = null, mixed $payload = null) { parent::__construct(null, $groups, $payload);
::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class Callback extends Constraint { /** * @var string|callable */ public $callback; /** * @param string|callable|null $callba
{ "filepath": "src/Symfony/Component/Validator/Constraints/Callback.php", "language": "php", "file_size": 1176, "cut_index": 518, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; use Symfony\Component\Validator\Const...
t $constraint): void { if (!$constraint instanceof Callback) { throw new UnexpectedTypeException($constraint, Callback::class); } $method = $constraint->callback; if ($method instanceof \Closure) {
raint. * * @author Bernhard Schussek <bschussek@gmail.com> */ class CallbackValidator extends ConstraintValidator { /** * @psalm-suppress ParamNameMismatch */ public function validate(mixed $object, Constrain
{ "filepath": "src/Symfony/Component/Validator/Constraints/CallbackValidator.php", "language": "php", "file_size": 2169, "cut_index": 563, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\...
/** * @param Response $response */ protected function matches($response): bool { return $response->isSuccessful(); } /** * @param Response $response */ protected function failureDescription($response): stri
failure. If false, the response body is omitted. */ public function __construct(private readonly bool $verbose = true) { } public function toString(): string { return 'is successful'; }
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsSuccessful.php", "language": "php", "file_size": 1306, "cut_index": 524, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\...
atches($response): bool { return $this->statusCode === $response->getStatusCode(); } /** * @param Response $response */ protected function failureDescription($response): string { return 'the Response '.$this->
ivate readonly bool $verbose = true, ) { } public function toString(): string { return 'status code is '.$this->statusCode; } /** * @param Response $response */ protected function m
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseStatusCodeSame.php", "language": "php", "file_size": 1259, "cut_index": 524, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher; use Symfony\Component\PasswordHasher\Except...
hrows InvalidPasswordException If the plain password is invalid, e.g. excessively long */ public function hash(#[\SensitiveParameter] string $plainPassword, ?string $salt = null): string; /** * Checks that a plain password and a salt mat
om> * @author Nicolas Grekas <p@tchwork.com> * @author Robin Chalas <robin.chalas@gmail.com> */ interface LegacyPasswordHasherInterface extends PasswordHasherInterface { /** * Hashes a plain password. * * @t
{ "filepath": "src/Symfony/Component/PasswordHasher/LegacyPasswordHasherInterface.php", "language": "php", "file_size": 1159, "cut_index": 518, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher; use Symfony\Component\PasswordHasher\Except...
invalid, e.g. excessively long */ public function hash(#[\SensitiveParameter] string $plainPassword): string; /** * Verifies a plain password against a hash. */ public function verify(string $hashedPassword, #[\SensitiveParamete
colas Grekas <p@tchwork.com> */ interface PasswordHasherInterface { public const MAX_PASSWORD_LENGTH = 4096; /** * Hashes a plain password. * * @throws InvalidPasswordException When the plain password is
{ "filepath": "src/Symfony/Component/PasswordHasher/PasswordHasherInterface.php", "language": "php", "file_size": 1181, "cut_index": 518, "middle_length": 229 }
hp namespace Symfony\Component\PasswordHasher\Tests\Fixtures; use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; final class TestLegacyPasswordAuthenticatedUser implements LegacyPasswordAuthenticatedUserInterface, UserInterface {...
{ return $this->salt; } public function getPassword(): ?string { return $this->password; } public function getRoles(): array { return $this->roles; } #[\Deprecated] public function eraseCrede
?string $salt = null, array $roles = []) { $this->roles = $roles; $this->salt = $salt; $this->password = $password; $this->username = $username; } public function getSalt(): ?string
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php", "language": "php", "file_size": 1122, "cut_index": 515, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Except...
new MessageDigestPasswordHasher('sha256', false, 1); $this->assertSame(hash('sha256', 'password'), $hasher->hash('password', '')); $hasher = new MessageDigestPasswordHasher('sha256', true, 1); $this->assertSame(base64_encode(hash(
) { $hasher = new MessageDigestPasswordHasher('sha256', false, 1); $this->assertTrue($hasher->verify(hash('sha256', 'password'), 'password', '')); } public function testHash() { $hasher =
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/MessageDigestPasswordHasherTest.php", "language": "php", "file_size": 2188, "cut_index": 563, "middle_length": 229 }
ony\Component\PasswordHasher\Hasher\MigratingPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; use Symfony\Component\PasswordHasher\Hasher\SodiumPa...
'class' => MessageDigestPasswordHasher::class, 'arguments' => ['sha512', true, 5], ]]); $hasher = $factory->getPasswordHasher($this->createStub(PasswordAuthenticatedUserInterface::class)); $expectedHasher = new
dUserInterface; class PasswordHasherFactoryTest extends TestCase { public function testGetHasherWithMessageDigestHasher() { $factory = new PasswordHasherFactory([PasswordAuthenticatedUserInterface::class => [
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php", "language": "php", "file_size": 10284, "cut_index": 921, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Compo...
hasher->verify('FOO', 'foo', '')); $hasher = new PlaintextPasswordHasher(true); $this->assertTrue($hasher->verify('foo', 'foo', '')); $this->assertFalse($hasher->verify('bar', 'foo', '')); $this->assertTrue($hasher->verify
nction testVerify() { $hasher = new PlaintextPasswordHasher(); $this->assertTrue($hasher->verify('foo', 'foo', '')); $this->assertFalse($hasher->verify('bar', 'foo', '')); $this->assertFalse($
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/PlaintextPasswordHasherTest.php", "language": "php", "file_size": 1830, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; use Symfony\Component\Passwo...
ony\Component\Security\Core\User\InMemoryUser; class UserPasswordHasherTest extends TestCase { public function testHashWithLegacyUser() { $user = new TestLegacyPasswordAuthenticatedUser('name', null, 'userSalt'); $passwordHasher =
omponent\PasswordHasher\PasswordHasherInterface; use Symfony\Component\PasswordHasher\Tests\Fixtures\TestLegacyPasswordAuthenticatedUser; use Symfony\Component\PasswordHasher\Tests\Fixtures\TestPasswordAuthenticatedUser; use Symf
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/UserPasswordHasherTest.php", "language": "php", "file_size": 4802, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component\PasswordHasher\Exception\LogicExcepti...
* @param bool $encodeHashAsBase64 Whether to base64 encode the password hash * @param int $iterations The number of iterations to use to stretch the password hash */ public function __construct( private string $algor
*/ class MessageDigestPasswordHasher implements LegacyPasswordHasherInterface { use CheckPasswordLengthTrait; private int $hashLength = -1; /** * @param string $algorithm The digest algorithm to use
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/MessageDigestPasswordHasher.php", "language": "php", "file_size": 3066, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\LogicException; use Symfony\Component\PasswordHasher\PasswordHasherInterface; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; /** * A generic hasher factory...
uthenticatedUserInterface|PasswordHasherAwareInterface $user): PasswordHasherInterface { $hasherKey = null; if ($user instanceof PasswordHasherAwareInterface && null !== $hasherName = $user->getPasswordHasherName()) { if (!
** * @param array<string, PasswordHasherInterface|array> $passwordHashers */ public function __construct( private array $passwordHashers, ) { } public function getPasswordHasher(string|PasswordA
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/PasswordHasherFactory.php", "language": "php", "file_size": 9045, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symf...
er of iterations) slows down the process. * PBKDF2 should be used with caution and care. * * @author Sebastiaan Stok <s.stok@rollerscapes.net> * @author Andrew Johnson * @author Fabien Potencier <fabien@symfony.com> */ final class Pbkdf2PasswordHashe
vation Function 2). * * Providing a high level of Cryptographic security, * PBKDF2 is recommended by the National Institute of Standards and Technology (NIST). * * But also warrants a warning, using PBKDF2 (with a high numb
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/Pbkdf2PasswordHasher.php", "language": "php", "file_size": 3019, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component\PasswordHasher\Exception\LogicExcepti...
public function __construct(?int $opsLimit = null, ?int $memLimit = null) { if (!self::isSupported()) { throw new LogicException('Libsodium is not available. You should either install the sodium extension or use a different pa
nbaldwin.com> * @author Dominik Müller <dominik.mueller@jkweb.ch> */ final class SodiumPasswordHasher implements PasswordHasherInterface { use CheckPasswordLengthTrait; private int $opsLimit; private int $memLimit;
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/SodiumPasswordHasher.php", "language": "php", "file_size": 4253, "cut_index": 614, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\...
} public function toString(): string { return 'format is '.($this->format ?? 'null'); } /** * @param Response $response */ protected function matches($response): bool { return $this->format === $this
dunglas@gmail.com> */ final class ResponseFormatSame extends Constraint { public function __construct( private Request $request, private ?string $format, private readonly bool $verbose = true, ) {
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseFormatSame.php", "language": "php", "file_size": 1484, "cut_index": 524, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; u...
his->path) { $str .= \sprintf(' with path "%s"', $this->path); } if ($this->domain) { $str .= \sprintf(' for domain "%s"', $this->domain); } return $str; } /** * @param Response $respon
string $name, private string $path = '/', private ?string $domain = null, ) { } public function toString(): string { $str = \sprintf('has cookie "%s"', $this->name); if ('/' !== $t
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHasCookie.php", "language": "php", "file_size": 1687, "cut_index": 537, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Co...
sponse $response */ protected function matches($response): bool { return $this->expectedValue === $response->headers->get($this->headerName, null); } /** * @param Response $response */ protected function failureD
private string $expectedValue, ) { } public function toString(): string { return \sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue); } /** * @param Re
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHeaderSame.php", "language": "php", "file_size": 1094, "cut_index": 515, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\...
/** * @param Response $response */ protected function matches($response): bool { return $response->isRedirect(); } /** * @param Response $response */ protected function failureDescription($response): string
failure. If false, the response body is omitted. */ public function __construct(private readonly bool $verbose = true) { } public function toString(): string { return 'is redirected'; }
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsRedirected.php", "language": "php", "file_size": 1304, "cut_index": 524, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; use Symfony\Component\HttpF...
messageType, implode(', ', $this->getExpectedMessages())); } protected function getExpectedMessages(): array { return \is_array($this->messages) ? $this->messages : [(string) $this->messages]; } protected function matches(mixe
private readonly string $messageType, private readonly mixed $messages, ) { } public function toString(): string { return \sprintf('session has flash message of type "%s" containing: %s', $this->
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/SessionHasFlashMessage.php", "language": "php", "file_size": 2261, "cut_index": 563, "middle_length": 229 }
sher; use Symfony\Component\Security\Core\User\InMemoryUser; class UserPasswordHashCommandTest extends TestCase { private ?CommandTester $passwordHasherCommandTester = null; private string|false $colSize; public function testEncodePasswordEmptySalt() { $this->passwordHasherCommandTester->execu...
wordHasherCommandTester->execute([ ], ['interactive' => false]); $this->assertStringContainsString('[ERROR] The password must not be empty.', $this->passwordHasherCommandTester->getDisplay()); $this->assertEquals(1, $statusCode);
]); $this->assertStringContainsString(' Password hash password', $this->passwordHasherCommandTester->getDisplay()); } public function testEncodeNoPasswordNoInteraction() { $statusCode = $this->pass
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Command/UserPasswordHashCommandTest.php", "language": "php", "file_size": 18874, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\TestWithJson; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component\Passwor...
ass); new NativePasswordHasher(null, null, 32); } #[DataProvider('validRangeData')] public function testCostInRange($cost) { $this->assertInstanceOf(NativePasswordHasher::class, new NativePasswordHasher(null, null, $cost));
$this->expectException(\InvalidArgumentException::class); new NativePasswordHasher(null, null, 3); } public function testCostAboveRange() { $this->expectException(\InvalidArgumentException::cl
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php", "language": "php", "file_size": 5423, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Hasher...
s->never())->method('hash'); $extraHasher->expects($this->never())->method('verify'); $extraHasher->expects($this->never())->method('needsRehash'); $hasher = new MigratingPasswordHasher($bestHasher, $extraHasher); $this->a
ends TestCase { public function testValidation() { $bestHasher = new NativePasswordHasher(4, 12000, 4); $extraHasher = $this->createMock(PasswordHasherInterface::class); $extraHasher->expects($thi
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/MigratingPasswordHasherTest.php", "language": "php", "file_size": 2296, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component\PasswordHasher\PasswordHasherInterfac...
n algorithm supported by password_hash() or null to use the best available algorithm */ public function __construct(?int $opsLimit = null, ?int $memLimit = null, ?int $cost = null, ?string $algorithm = null) { $cost ??= 13; $op
inal class NativePasswordHasher implements PasswordHasherInterface { use CheckPasswordLengthTrait; private string $algorithm = \PASSWORD_BCRYPT; private array $options; /** * @param string|null $algorithm A
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/NativePasswordHasher.php", "language": "php", "file_size": 4249, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symf...
rait; /** * @param bool $ignorePasswordCase Compare password case-insensitive */ public function __construct( private bool $ignorePasswordCase = false, ) { } public function hash(#[\SensitiveParameter] string $plainP
phically secure, usage of it in production environments is discouraged. * * @author Fabien Potencier <fabien@symfony.com> */ class PlaintextPasswordHasher implements LegacyPasswordHasherInterface { use CheckPasswordLengthT
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/PlaintextPasswordHasher.php", "language": "php", "file_size": 2260, "cut_index": 563, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\Constraint; use Symfony\Component\HttpFoundation\Response;...
} /** * @param Response $response */ protected function matches($response): bool { return $response->headers->has($this->headerName); } /** * @param Response $response */ protected function failure
turn \sprintf('has header "%s"', $this->headerName);
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseHasHeader.php", "language": "php", "file_size": 985, "cut_index": 582, "middle_length": 52 }
buted with this source code. */ namespace Symfony\Component\PasswordHasher\Command; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; use Symfony\C...
t\OutputInterface; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\LegacyPasswordHasherInter
Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Outpu
{ "filepath": "src/Symfony/Component/PasswordHasher/Command/UserPasswordHashCommand.php", "language": "php", "file_size": 9088, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component...
asher(); $result = $hasher->hash('password'); $this->assertTrue($hasher->verify($result, 'password')); $this->assertFalse($hasher->verify($result, 'anotherPassword')); $this->assertFalse($hasher->verify($result, '')); }
: void { if (!SodiumPasswordHasher::isSupported()) { $this->markTestSkipped('Libsodium is not available.'); } } public function testValidation() { $hasher = new SodiumPasswordH
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php", "language": "php", "file_size": 3764, "cut_index": 614, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\PasswordHasher\PasswordHasherInte...
$extraHashers; public function __construct( private PasswordHasherInterface $bestHasher, PasswordHasherInterface ...$extraHashers, ) { $this->extraHashers = $extraHashers; } public function hash(#[\SensitiveParamet
sh * could be used to authenticate successfully without knowing the cleartext password. * * @author Nicolas Grekas <p@tchwork.com> */ final class MigratingPasswordHasher implements PasswordHasherInterface { private array
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/MigratingPasswordHasher.php", "language": "php", "file_size": 1853, "cut_index": 537, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Test\Constraint; use PHPUnit\Framework\Constraint\...
} /** * @param Response $other */ protected function matches($other): bool { return Response::HTTP_UNPROCESSABLE_ENTITY === $other->getStatusCode(); } /** * @param Response $other */ protected function
on failure. If false, the response body is omitted. */ public function __construct(private readonly bool $verbose = true) { } public function toString(): string { return 'is unprocessable';
{ "filepath": "src/Symfony/Component/HttpFoundation/Test/Constraint/ResponseIsUnprocessable.php", "language": "php", "file_size": 1338, "cut_index": 524, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Tests\Hasher; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Except...
tion testHash() { $hasher = new Pbkdf2PasswordHasher('sha256', false, 1, 40); $this->assertSame('c1232f10f62715fda06ae7c0a2037ca19b33cf103b727ba56d870c11f290a2ab106974c75607c8a3', $hasher->hash('password', '')); $hasher = new P
$hasher = new Pbkdf2PasswordHasher('sha256', false, 1, 40); $this->assertTrue($hasher->verify('c1232f10f62715fda06ae7c0a2037ca19b33cf103b727ba56d870c11f290a2ab106974c75607c8a3', 'password', '')); } public func
{ "filepath": "src/Symfony/Component/PasswordHasher/Tests/Hasher/Pbkdf2PasswordHasherTest.php", "language": "php", "file_size": 2071, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\Security\Core\User\LegacyPassword...
) { } public function hashPassword(PasswordAuthenticatedUserInterface $user, #[\SensitiveParameter] string $plainPassword): string { $salt = null; if ($user instanceof LegacyPasswordAuthenticatedUserInterface) { $sa
Ariel Ferrandini <arielferrandini@gmail.com> * * @final */ class UserPasswordHasher implements UserPasswordHasherInterface { public function __construct( private PasswordHasherFactoryInterface $hasherFactory,
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/UserPasswordHasher.php", "language": "php", "file_size": 1998, "cut_index": 537, "middle_length": 229 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\PasswordHasher\Hasher; use Symfony\Component\Password...
the given user. * * @throws \RuntimeException When no password hasher could be found for the user */ public function getPasswordHasher(string|PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user): PasswordHasherInterfac
fferent user accounts. * * @author Robin Chalas <robin.chalas@gmail.com> * @author Johannes M. Schmitt <schmittjoh@gmail.com> */ interface PasswordHasherFactoryInterface { /** * Returns the password hasher to use for
{ "filepath": "src/Symfony/Component/PasswordHasher/Hasher/PasswordHasherFactoryInterface.php", "language": "php", "file_size": 1002, "cut_index": 512, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; use Symfony\Component\Validator\Excep...
NPAY'; public const DINERS = 'DINERS'; public const DISCOVER = 'DISCOVER'; public const INSTAPAYMENT = 'INSTAPAYMENT'; public const JCB = 'JCB'; public const LASER = 'LASER'; public const MAESTRO = 'MAESTRO'; public const MASTER
gmail.com> */ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class CardScheme extends Constraint { public const AMEX = 'AMEX'; public const CHINA_UNIONPAY = 'CHINA_UNIO
{ "filepath": "src/Symfony/Component/Validator/Constraints/CardScheme.php", "language": "php", "file_size": 2297, "cut_index": 563, "middle_length": 229 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; /** * Validates that a value is equal to anoth...
ractComparison { public const NOT_EQUAL_ERROR = '478618a7-95ba-473d-9101-cabd45e49115'; protected const ERROR_NAMES = [ self::NOT_EQUAL_ERROR => 'NOT_EQUAL_ERROR', ]; public string $message = 'This value should be equal to {{ comp
ttribute::IS_REPEATABLE)] class EqualTo extends Abst
{ "filepath": "src/Symfony/Component/Validator/Constraints/EqualTo.php", "language": "php", "file_size": 856, "cut_index": 529, "middle_length": 52 }
s part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; /** * @a...
[], ?array $groups = null, mixed $payload = null) { $this->constraints = $constraints; parent::__construct(null, $groups, $payload); } protected function getCompositeOption(): string { return 'constraints'; }
$constraints =
{ "filepath": "src/Symfony/Component/Validator/Constraints/Existence.php", "language": "php", "file_size": 808, "cut_index": 536, "middle_length": 14 }
* * 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\Expression as ExpressionObject; use Symfony\Component\ExpressionLanguage\ExpressionLanguage...
ien Potencier <fabien@symfony.com> * @author Bernhard Schussek <bschussek@gmail.com> */ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] class Expression extends Constraint {
t\Validator\Exception\MissingOptionsException; /** * Validates a value using an expression from the Expression Language component. * * @see https://symfony.com/doc/current/components/expression_language.html * * @author Fab
{ "filepath": "src/Symfony/Component/Validator/Constraints/Expression.php", "language": "php", "file_size": 3322, "cut_index": 614, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Expressio...
%s)->getViolations()->count()', implode(', ', $arguments) ), static fn (array $variables, ...$arguments): bool => 0 === $variables['context']->getValidator()->inContext($variables['context'])->validate(...$arguments)->getViolati
public function getFunctions(): array { return [ new ExpressionFunction('is_valid', static fn (...$arguments) => \sprintf( '0 === $context->getValidator()->inContext($context)->validate(
{ "filepath": "src/Symfony/Component/Validator/Constraints/ExpressionLanguageProvider.php", "language": "php", "file_size": 1034, "cut_index": 513, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\Validator\Constraint; use Symfony\Component\Validator\Excep...
MES = [ self::EXPRESSION_SYNTAX_ERROR => 'EXPRESSION_SYNTAX_ERROR', ]; public string $message = 'This value should be a valid expression.'; public ?string $service = null; public ?array $allowedVariables = null; /** * @pa
ARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class ExpressionSyntax extends Constraint { public const EXPRESSION_SYNTAX_ERROR = 'e219aa22-8b11-48ec-81a0-fc07cdb0e13f'; protected const ERROR_NA
{ "filepath": "src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php", "language": "php", "file_size": 2095, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\ExpressionLanguage; use Symfony\Componen...
aintValidator { public function __construct( private ?ExpressionLanguage $expressionLanguage = null, ) { } /** * @psalm-suppress ParamNameMismatch */ public function validate(mixed $expression, Constraint $constraint)
Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; /** * @author Andrey Sevastianov <mrpkmail@gmail.com> */ class ExpressionSyntaxValidator extends Constr
{ "filepath": "src/Symfony/Component/Validator/Constraints/ExpressionSyntaxValidator.php", "language": "php", "file_size": 2212, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\ExpressionLanguage; use Symfony\Componen...
essionLanguage = null) { if ($expressionLanguage) { $this->expressionLanguage = $expressionLanguage; } } public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof
.com> * @author Bernhard Schussek <bschussek@symfony.com> */ class ExpressionValidator extends ConstraintValidator { private ExpressionLanguage $expressionLanguage; public function __construct(?ExpressionLanguage $expr
{ "filepath": "src/Symfony/Component/Validator/Constraints/ExpressionValidator.php", "language": "php", "file_size": 2072, "cut_index": 563, "middle_length": 229 }
nt\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\InvalidArgumentException; /** * Validates that a value is a valid "file". * * A file can be one of the following: * - A string (or object with a __toString() method) path to an existing file; * - A valid {@see \Sym...
ROR = 'd2a3fb6e-7ddc-4210-8fbf-2ab345ce1998'; public const NOT_READABLE_ERROR = 'c20c92a4-5bfa-4202-9477-28e800e0f6ff'; public const EMPTY_ERROR = '5d743385-9775-4aa5-8ff5-495fb1e60137'; public const TOO_LARGE_ERROR = 'df8637af-d466-48c6-a59d-e
ibute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class File extends Constraint { // Check the Image constraint for clashes if adding new constants here public const NOT_FOUND_ER
{ "filepath": "src/Symfony/Component/Validator/Constraints/File.php", "language": "php", "file_size": 12241, "cut_index": 921, "middle_length": 229 }
se Symfony\Component\Mime\MimeTypes; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\LogicException; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueExce...
self::MIB_BYTES => 'MiB', ]; public function validate(mixed $value, Constraint $constraint): void { if (!$constraint instanceof File) { throw new UnexpectedTypeException($constraint, File::class); } if (nul
public const KIB_BYTES = 1024; public const MIB_BYTES = 1048576; private const SUFFICES = [ 1 => 'bytes', self::KB_BYTES => 'kB', self::MB_BYTES => 'MB', self::KIB_BYTES => 'KiB',
{ "filepath": "src/Symfony/Component/Validator/Constraints/FileValidator.php", "language": "php", "file_size": 13456, "cut_index": 921, "middle_length": 229 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; /** * Validates that a value is greater than a...
nds AbstractComparison { public const TOO_LOW_ERROR = '778b7ae0-84d3-481a-9dec-35fdb64b1d78'; protected const ERROR_NAMES = [ self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', ]; public string $message = 'This value should be greater than {
| \Attribute::IS_REPEATABLE)] class GreaterThan exte
{ "filepath": "src/Symfony/Component/Validator/Constraints/GreaterThan.php", "language": "php", "file_size": 862, "cut_index": 529, "middle_length": 52 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; /** * Validates that a value is greater than or equal to another...
ends AbstractComparison { public const TOO_LOW_ERROR = 'ea4e51d1-3342-48bd-87f1-9e672cd90cad'; protected const ERROR_NAMES = [ self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', ]; public string $message = 'This value should be greater than
ribute::IS_REPEATABLE)] class GreaterThanOrEqual ext
{ "filepath": "src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php", "language": "php", "file_size": 893, "cut_index": 547, "middle_length": 52 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; /** * Validates values are greater than o...
or { protected function compareValues(mixed $value1, mixed $value2): bool { return null === $value2 || $value1 >= $value2; } protected function getErrorCode(): ?string { return GreaterThanOrEqual::TOO_LOW_ERROR; } }
parisonValidat
{ "filepath": "src/Symfony/Component/Validator/Constraints/GreaterThanOrEqualValidator.php", "language": "php", "file_size": 795, "cut_index": 524, "middle_length": 14 }