prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
ry\HttpFoundationFactory;
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Response;
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\ServerRequest;
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Stream;
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\UploadedFile;
use Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Ur... | cted function setUp(): void
{
$this->factory = new HttpFoundationFactory();
$this->tmpDir = sys_get_temp_dir();
}
public function testCreateRequest()
{
$stdClass = new \stdClass();
$serverRequest = new Serve | dedFile;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class HttpFoundationFactoryTest extends TestCase
{
/** @var HttpFoundationFactory */
private $factory;
/** @var string */
private $tmpDir;
prote | {
"filepath": "src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/HttpFoundationFactoryTest.php",
"language": "php",
"file_size": 9816,
"cut_index": 921,
"middle_length": 229
} |
;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfo... | ')]
public function testCreateRequest(PsrHttpFactory $factory)
{
$stdClass = new \stdClass();
$request = new Request(
[
'bar' => ['baz' => '42'],
'foo' => '1',
],
[ | illevesse@hotmail.fr>
*/
class PsrHttpFactoryTest extends TestCase
{
private string $tmpDir;
protected function setUp(): void
{
$this->tmpDir = sys_get_temp_dir();
}
#[DataProvider('provideFactories | {
"filepath": "src/Symfony/Bridge/PsrHttpMessage/Tests/Factory/PsrHttpFactoryTest.php",
"language": "php",
"file_size": 10669,
"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\Bridge\PsrHttpMessage\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\B... | {
$listener = new PsrResponseListener();
$event = $this->createEventMock(new Response());
$listener->onKernelView($event);
self::assertTrue($event->hasResponse());
}
public function testDoesNotConvertControllerRe | l\Event\ViewEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class PsrResponseListenerTest extends TestCase
{
public function testConvertsControllerResult()
| {
"filepath": "src/Symfony/Bridge/PsrHttpMessage/Tests/EventListener/PsrResponseListenerTest.php",
"language": "php",
"file_size": 1600,
"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\Bridge\PsrHttpMessage\Tests\ArgumentValueResolver;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\MessageInt... | rRequestResolverTest extends TestCase
{
public function testServerRequest()
{
$symfonyRequest = new Request();
$psrRequest = $this->createStub(ServerRequestInterface::class);
$resolver = $this->bootstrapResolver($symfonyReq | \PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
/**
* @author Alexander M. Turek <me@derrabus.de>
*/
final class PsrServe | {
"filepath": "src/Symfony/Bridge/PsrHttpMessage/Tests/ArgumentValueResolver/PsrServerRequestResolverTest.php",
"language": "php",
"file_size": 2460,
"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\Bridge\PsrHttpMessage\ArgumentValueResolver;
use Psr\Http\Message\MessageInterface;
use ... | d.
*
* @author Iltar van der Berg <kjarli@gmail.com>
* @author Alexander M. Turek <me@derrabus.de>
*/
final class PsrServerRequestResolver implements ValueResolverInterface
{
private const SUPPORTED_TYPES = [
ServerRequestInterface::class = | Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
/**
* Injects the RequestInterface, MessageInterface or ServerRequestInterface when requeste | {
"filepath": "src/Symfony/Bridge/PsrHttpMessage/ArgumentValueResolver/PsrServerRequestResolver.php",
"language": "php",
"file_size": 1508,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\FlashBagAwareSessionInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Compon... | kenStorageInterface $tokenStorage;
private RequestStack $requestStack;
private string $environment;
private bool $debug;
private LocaleSwitcher $localeSwitcher;
private array $enabledLocales;
public function setTokenStorage(TokenSt | rface;
use Symfony\Component\Translation\LocaleSwitcher;
/**
* Exposes some Symfony parameters and services as an "app" global variable.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class AppVariable
{
private To | {
"filepath": "src/Symfony/Bridge/Twig/AppVariable.php",
"language": "php",
"file_size": 6090,
"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\Bridge\Twig;
use Composer\InstalledVersions;
use Symfony\Bundle\FullStack;
use Twig\Error\SyntaxError;
use Twig\TwigFilter;
use Twig\TwigFunction;
/**
* @internal
... | et' => 'asset',
'asset_version' => 'asset',
'importmap' => 'asset-mapper',
'dump' => 'debug-bundle',
'encore_entry_link_tags' => 'webpack-encore-bundle',
'encore_entry_script_tags' => 'webpack-encore-bundle',
| alize' => 'serializer',
'trans' => 'translation',
'sanitize_html' => 'html-sanitizer',
'yaml_encode' => 'yaml',
'yaml_dump' => 'yaml',
];
private const FUNCTION_COMPONENTS = [
'ass | {
"filepath": "src/Symfony/Bridge/Twig/UndefinedCallableHandler.php",
"language": "php",
"file_size": 4398,
"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\Bridge\Twig\Extension;
use Symfony\Component\Asset\Packages;
use Twig\Exten... | ..)),
new TwigFunction('asset_version', $this->getAssetVersion(...)),
];
}
/**
* Returns the public url/path of an asset.
*
* If the package used to generate the path is an instance of
* UrlPackage, you will | s AbstractExtension
{
public function __construct(
private Packages $packages,
) {
}
public function getFunctions(): array
{
return [
new TwigFunction('asset', $this->getAssetUrl(. | {
"filepath": "src/Symfony/Bridge/Twig/Extension/AssetExtension.php",
"language": "php",
"file_size": 1430,
"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\Bridge\Twig\Extension;
use Symfony\Bridge\Twig\TokenParser\DumpTokenParser;
use Symfony\... | erface $cloner,
private ?HtmlDumper $dumper = null,
) {
}
public function getFunctions(): array
{
return [
new TwigFunction('dump', $this->dump(...), ['is_safe' => ['html'], 'needs_context' => true, 'needs_envir | ion;
/**
* Provides integration of the dump() function with Twig.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
final class DumpExtension extends AbstractExtension
{
public function __construct(
private ClonerInt | {
"filepath": "src/Symfony/Bridge/Twig/Extension/DumpExtension.php",
"language": "php",
"file_size": 1995,
"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\Bridge\Twig\Extension;
use Symfony\Component\Emoji\EmojiTransliterator;
use Twig\Extensi... | ojify" filter as the "Emoji" component is not installed. Try running "composer require symfony/emoji".');
}
}
public function getFilters(): array
{
return [
new TwigFilter('emojify', $this->emojify(...)),
]; | tors = [];
public function __construct(
private readonly string $defaultCatalog = 'text',
) {
if (!class_exists(EmojiTransliterator::class)) {
throw new \LogicException('You cannot use the "em | {
"filepath": "src/Symfony/Bridge/Twig/Extension/EmojiExtension.php",
"language": "php",
"file_size": 1604,
"cut_index": 537,
"middle_length": 229
} |
t;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
use Symfony\Component\HttpKernel\Exception\NearMissValueResolverException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class EntityValueResolverTest extends TestCase
{
public function testResolveWithoutClass()
{
... | anager = $this->createStub(ObjectManager::class);
$registry = $this->createRegistry($manager);
$resolver = new EntityValueResolver($registry, null, new MapEntity(disabled: true));
$request = new Request();
$argument = $this | uest();
$argument = new ArgumentMetadata('arg', null, false, false, null);
$this->assertSame([], $resolver->resolve($request, $argument));
}
public function testResolveWithoutAttribute()
{
$m | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php",
"language": "php",
"file_size": 18908,
"cut_index": 1331,
"middle_length": 229
} |
ackage.
*
* (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\Bridge\Twig\Extension;
use Symfony\Component\ExpressionLanguage\Expression;
use Twig\Extension\AbstractExtensi... | tFunctions(): array
{
return [
new TwigFunction('expression', $this->createExpression(...)),
];
}
public function createExpression(string $expression): Expression
{
return new Expression($expression);
| n extends AbstractExtension
{
public function ge | {
"filepath": "src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php",
"language": "php",
"file_size": 873,
"cut_index": 559,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\SchemaListener;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;... | maListenerTest extends TestCase
{
public function testPostGenerateSchemaPdo()
{
$schema = new Schema();
$dbalConnection = $this->createStub(Connection::class);
$dbalConnection->method('getConfiguration')->willReturn(new Conf | ny\Bridge\Doctrine\SchemaListener\PdoSessionHandlerSchemaListener;
use Symfony\Bridge\Doctrine\Tests\DoctrineTestHelper;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
class PdoSessionHandlerSche | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/SchemaListener/PdoSessionHandlerSchemaListenerTest.php",
"language": "php",
"file_size": 4036,
"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\Bridge\Doctrine\Tests\Security\RememberMe;
use Doctrine\DBAL\DriverManager;
use Doctrine... | oid
{
if (!getenv('POSTGRES_HOST')) {
self::markTestSkipped('Missing POSTGRES_HOST env variable');
}
}
protected function bootstrapProvider(): DoctrineTokenProvider
{
$config = ORMSetup::createConfigurat | Security\RememberMe\DoctrineTokenProvider;
#[Group('integration')]
#[RequiresPhpExtension('pdo_pgsql')]
class DoctrineTokenProviderPostgresTest extends DoctrineTokenProviderTest
{
public static function setUpBeforeClass(): v | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderPostgresTest.php",
"language": "php",
"file_size": 2005,
"cut_index": 537,
"middle_length": 229
} |
neTestHelper;
use Symfony\Bridge\Doctrine\Tests\Fixtures\BaseUser;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderEmbed;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderEnum;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderNest... | Mapping\CascadingStrategy;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
use Symfony\Component\Validator\Mapping\TraversalStrategy;
use Symfony\Component\Validator\Tests\Fixtures\NestedAttr | tor\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\DoctrineLoader;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Mapping\AutoMappingStrategy;
use Symfony\Component\Validator\ | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php",
"language": "php",
"file_size": 11291,
"cut_index": 921,
"middle_length": 229
} |
ntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdStringWrapperNameEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdWithPrivateNameEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\Type\StringWrapper;
use Symfony\Bridge\Doctrine\T... | epositoryFactory;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Val |
use Symfony\Bridge\Doctrine\Tests\Fixtures\UpdateEmployeeProfile;
use Symfony\Bridge\Doctrine\Tests\Fixtures\UserUuidNameDto;
use Symfony\Bridge\Doctrine\Tests\Fixtures\UserUuidNameEntity;
use Symfony\Bridge\Doctrine\Tests\TestR | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php",
"language": "php",
"file_size": 36762,
"cut_index": 2151,
"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\Bridge\Doctrine\Tests\Messenger;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManagerInterface;
use Doctri... | eConnectionMiddlewareTest extends MiddlewareTestCase
{
private MockObject&Connection $connection;
private EntityManagerInterface $entityManager;
private ManagerRegistry $managerRegistry;
private DoctrineCloseConnectionMiddleware $middleware | use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Stamp\ConsumedByWorkerStamp;
use Symfony\Component\Messenger\Test\Middleware\MiddlewareTestCase;
class DoctrineClos | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php",
"language": "php",
"file_size": 3019,
"cut_index": 563,
"middle_length": 229
} |
Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectRepository;
use Doctrine\Persistence\Proxy;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Security\User\EntityUse... | sswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[IgnoreDeprecations]
#[Group('doctrine-dbal-workaround')]
class EntityUserProviderTest extends TestCase
{
public function testRefreshUserGetsUserByPrimaryKey()
{
| ponent\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\Pa | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php",
"language": "php",
"file_size": 9907,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\ContainerAwareEventManager;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
use Symfony\Componen... | $container = $this->createBuilder();
$abstractDefinition = new Definition('stdClass');
$abstractDefinition->setAbstract(true);
$abstractDefinition->addTag('doctrine.event_listener', ['event' => 'test']);
$container->se | ependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ServiceLocator;
class RegisterEventListenersAndSubscribersPassTest extends TestCase
{
public function testExceptionOnAbstractTaggedListener()
{
| {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php",
"language": "php",
"file_size": 8781,
"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\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;
use PHPUnit\Framewo... | ne.dbal.connection_factory.types', ['foo' => 'bar']);
(new RegisterUidTypePass())->process($container);
$expected = [
'foo' => 'bar',
'uuid' => ['class' => UuidType::class],
'ulid' => ['class' => UlidTyp | ny\Component\DependencyInjection\ContainerBuilder;
class RegisterUidTypePassTest extends TestCase
{
public function testRegistered()
{
$container = new ContainerBuilder();
$container->setParameter('doctri | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterUidTypePassTest.php",
"language": "php",
"file_size": 1354,
"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\Bridge\Doctrine\Messenger;
use Doctrine\Persistence\ManagerRegistry;
use Sy... | lic function __construct(
private readonly ManagerRegistry $managerRegistry,
) {
}
public function onWorkerMessageHandled(): void
{
$this->clearEntityManagers();
}
public function onWorkerMessageFailed(): void
| * Clears entity managers between messages being handled to avoid outdated data.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
class DoctrineClearEntityManagerWorkerSubscriber implements EventSubscriberInterface
{
pub | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/DoctrineClearEntityManagerWorkerSubscriber.php",
"language": "php",
"file_size": 1473,
"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\Bridge\Doctrine\Messenger;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persist... | ct(
ManagerRegistry $managerRegistry,
?string $entityManagerName = null,
private readonly ?LoggerInterface $logger = null,
) {
parent::__construct($managerRegistry, $entityManagerName);
}
protected function hand | on has been left open.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class DoctrineOpenTransactionLoggerMiddleware extends AbstractDoctrineMiddleware
{
private bool $isHandling = false;
public function __constru | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php",
"language": "php",
"file_size": 1822,
"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\Bridge\Doctrine\Messenger;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component... | Envelope $envelope, StackInterface $stack): Envelope
{
if (null !== $envelope->last(ConsumedByWorkerStamp::class)) {
// In multi-EM mode (no explicit entityManagerName), ping every manager and let healthy ones
// procee | or reconnects otherwise.
*
* @author Fuong <insidestyles@gmail.com>
*/
class DoctrinePingConnectionMiddleware extends AbstractDoctrineMiddleware
{
protected function handleForManager(EntityManagerInterface $entityManager, | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php",
"language": "php",
"file_size": 3327,
"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\Bridge\Doctrine\ArgumentResolver;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NoResultException;
use Doctr... |
*
* @internal
*/
trait EntityValueResolverTrait
{
/**
* Gets the entity manager for the given class.
*/
private function getManager(ManagerRegistry $registry, ?string $name, string $class): ?ObjectManager
{
if (null === $n | rovides common entity resolution logic for both HTTP and Console value resolvers.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jérémy Derussé <jeremy@derusse.com>
* @author Robin Chalas <robin.chalas@gmail.com> | {
"filepath": "src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolverTrait.php",
"language": "php",
"file_size": 4509,
"cut_index": 614,
"middle_length": 229
} |
ne\DBAL\Schema\Name\UnqualifiedName;
use Doctrine\DBAL\Schema\PrimaryKeyConstraint;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Types;
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
use Symfony\Component\Security\Core\Authentication\RememberMe... | n
* the client machine, and thus the security is improved.
*
* This depends only on doctrine in order to get a database connection
* and to do the conversion of the datetime column.
*
* In order to use this class, you need the following table in your | rface;
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
/**
* This class provides storage for the tokens that is set in "remember-me"
* cookies. This way no password secrets will be stored in the cookies o | {
"filepath": "src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php",
"language": "php",
"file_size": 9416,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\Security\User;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectRepository;
use Doctrine\Persistence\Proxy;
use Symfony\Component\Security\... | Core\User\UserProviderInterface;
/**
* Wrapper around a Doctrine ObjectManager.
*
* Provides provisioning for Doctrine entity users.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @templa | Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\ | {
"filepath": "src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php",
"language": "php",
"file_size": 6018,
"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\Bridge\Doctrine\DependencyInjection\Security\UserProvider;
use Symfony\Bundle\SecurityBu... | rg>
*
* @final
*/
class EntityFactory implements UserProviderFactoryInterface
{
public function __construct(
private readonly string $key,
private readonly string $providerId,
) {
}
public function create(ContainerBuilde | nition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* EntityFactory creates services for Doctrine user provider.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Christophe Coevoet <stof@notk.o | {
"filepath": "src/Symfony/Bridge/Doctrine/DependencyInjection/Security/UserProvider/EntityFactory.php",
"language": "php",
"file_size": 1893,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\Security\RememberMe;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\ORM\ORMSetup;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doct... | ken::class, 'getClass')) {
$token = new PersistentToken('someClass', 'someUser', 'someSeries', 'tokenValue', new \DateTimeImmutable('2013-01-26T18:23:51'), false);
} else {
$token = new PersistentToken('someUser', 'someSerie | ion;
#[RequiresPhpExtension('pdo_sqlite')]
class DoctrineTokenProviderTest extends TestCase
{
public function testCreateNewToken()
{
$provider = $this->bootstrapProvider();
if (method_exists(PersistentTo | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Security/RememberMe/DoctrineTokenProviderTest.php",
"language": "php",
"file_size": 6790,
"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\Bridge\Doctrine\Tests\SchemaListener;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\EntityManagerI... | rsistentRememberMeHandler;
class RememberMeTokenProviderDoctrineSchemaListenerTest extends TestCase
{
public static function setUpBeforeClass(): void
{
if (!class_exists(PersistentRememberMeHandler::class)) {
self::markTestSkip | mfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\RememberMe\Pe | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/SchemaListener/RememberMeTokenProviderDoctrineSchemaListenerTest.php",
"language": "php",
"file_size": 3323,
"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\Bridge\Doctrine\Tests\Validator\Constraints;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Validator... | );
/** @var UniqueEntity $constraint */
[$constraint] = $metadata->getConstraints();
self::assertSame(['email'], $constraint->fields);
self::assertTrue($constraint->ignoreNull);
self::assertSame('doctrine.orm.valida | public function testAttributeWithDefaultProperty()
{
$metadata = new ClassMetadata(UniqueEntityDummyOne::class);
$loader = new AttributeLoader();
self::assertTrue($loader->loadClassMetadata($metadata) | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityTest.php",
"language": "php",
"file_size": 2966,
"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\Bridge\Doctrine\Tests\Messenger;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\EntityManagerInterface;
use Doctri... | MockObject&Connection $connection;
private EntityManagerInterface $entityManager;
private DoctrineOpenTransactionLoggerMiddleware $middleware;
protected function setUp(): void
{
$this->logger = new class extends AbstractLogger {
| ony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Test\Middleware\MiddlewareTestCase;
class DoctrineOpenTransactionLoggerMiddlewareTest extends MiddlewareTestCase
{
private AbstractLogger $logger;
private | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php",
"language": "php",
"file_size": 2188,
"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\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;
use PHPUnit\Framework\TestCase;
... | $this->expectExceptionMessage('Could not find the manager name parameter in the container. Tried the following parameter names: "manager.param.one", "manager.param.two"');
$this->process($container, [
'manager.param.one',
| ion;
class RegisterMappingsPassTest extends TestCase
{
public function testNoDriverParmeterException()
{
$container = $this->createBuilder();
$this->expectException(\InvalidArgumentException::class);
| {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php",
"language": "php",
"file_size": 1565,
"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\Bridge\Doctrine\Messenger;
use Doctrine\ORM\EntityManagerInterface... | $entityManager, Envelope $envelope, StackInterface $stack): Envelope
{
try {
$connection = $entityManager->getConnection();
return $stack->next()->handle($envelope, $stack);
} finally {
if (null !== | d therefore saves number of connections.
*
* @author Fuong <insidestyles@gmail.com>
*/
class DoctrineCloseConnectionMiddleware extends AbstractDoctrineMiddleware
{
protected function handleForManager(EntityManagerInterface | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/DoctrineCloseConnectionMiddleware.php",
"language": "php",
"file_size": 1120,
"cut_index": 515,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\ArgumentResolver;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\HttpFoundation\Requ... | émy Derussé <jeremy@derusse.com>
*/
final class EntityValueResolver implements ValueResolverInterface
{
use EntityValueResolverTrait;
public function __construct(
private ManagerRegistry $registry,
private ?ExpressionLanguage $exp | ssValueResolverException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Yields the entity matching the criteria provided in the route.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jér | {
"filepath": "src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php",
"language": "php",
"file_size": 5591,
"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\Bridge\Doctrine\Security\User;
use Symfony\Component\Security\Co... | l Trojanowski <michal@kmt-studio.pl>
*/
interface UserLoaderInterface
{
/**
* Loads the user for the given user identifier (e.g. username or email).
*
* This method must return null if the user is not found.
*/
public function | f a User from Doctrine source using a custom method.
* If you want to implement your own logic of retrieving the user from Doctrine your repository should implement this
* interface.
*
* @see UserInterface
*
* @author Micha | {
"filepath": "src/Symfony/Bridge/Doctrine/Security/User/UserLoaderInterface.php",
"language": "php",
"file_size": 1058,
"cut_index": 513,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\SchemaListener;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Ev... | a = new Schema();
$dbalConnection = $this->createStub(Connection::class);
$dbalConnection->method('getConfiguration')->willReturn(new Configuration());
$entityManager = $this->createMock(EntityManagerInterface::class);
$enti | e\Transport\DoctrineTransport;
use Symfony\Component\Messenger\Transport\TransportInterface;
class MessengerTransportDoctrineSchemaListenerTest extends TestCase
{
public function testPostGenerateSchema()
{
$schem | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/SchemaListener/MessengerTransportDoctrineSchemaListenerTest.php",
"language": "php",
"file_size": 6917,
"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\Bridge\Doctrine\Tests\Messenger;
use Doctrine\ORM\EntityManagerInterface;
u... | ntityManager1->expects($this->once())
->method('clear');
$entityManager2 = $this->createMock(EntityManagerInterface::class);
$entityManager2->expects($this->once())
->method('clear');
$managerRegistry = $th | class DoctrineClearEntityManagerWorkerSubscriberTest extends MiddlewareTestCase
{
public function testMiddlewareClearEntityManager()
{
$entityManager1 = $this->createMock(EntityManagerInterface::class);
$e | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineClearEntityManagerWorkerSubscriberTest.php",
"language": "php",
"file_size": 1316,
"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\Bridge\Doctrine\Messenger;
use Doctrine\ORM\EntityManagerInterface;
use Doc... | reInterface
{
public function __construct(
protected ManagerRegistry $managerRegistry,
protected ?string $entityManagerName = null,
) {
}
final public function handle(Envelope $envelope, StackInterface $stack): Envelope
| ddleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
/**
* @author Konstantin Myakshin <molodchick@gmail.com>
*
* @internal
*/
abstract class AbstractDoctrineMiddleware implements Middlewa | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php",
"language": "php",
"file_size": 1489,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\ArgumentResolver\Console;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolverTrait;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
use Symfony\Component\C... | rface;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\String\UnicodeString;
/**
* Resolves a Command parameter holding the #[MapEntity] attribute to an Entity.
*
* @author Fabien Potencier <fabien@symfony.com>
* @au | rgument;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInte | {
"filepath": "src/Symfony/Bridge/Doctrine/ArgumentResolver/Console/EntityValueResolver.php",
"language": "php",
"file_size": 6987,
"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\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;
use PHPUnit\Framewo... | ner = new ContainerBuilder();
$container->setParameter('doctrine.dbal.connection_factory.types', ['foo' => 'bar']);
(new RegisterDatePointTypePass())->process($container);
$expected = [
'foo' => 'bar',
'date | Type;
use Symfony\Bridge\Doctrine\Types\TimePointType;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class RegisterDatePointTypePassTest extends TestCase
{
public function testRegistered()
{
$contai | {
"filepath": "src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterDatePointTypePassTest.php",
"language": "php",
"file_size": 1304,
"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\Bridge\Doctrine\Messenger;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Componen... | orManager(EntityManagerInterface $entityManager, Envelope $envelope, StackInterface $stack): Envelope
{
$entityManager->getConnection()->beginTransaction();
$success = false;
try {
$envelope = $stack->next()->handle | Stamp;
/**
* Wraps all handlers in a single doctrine transaction.
*
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class DoctrineTransactionMiddleware extends AbstractDoctrineMiddleware
{
protected function handleF | {
"filepath": "src/Symfony/Bridge/Doctrine/Messenger/DoctrineTransactionMiddleware.php",
"language": "php",
"file_size": 1937,
"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\Bridge\Twig\Extension;
use Psr\Container\ContainerInterface;
us... | r('sanitize_html', $this->sanitize(...), ['is_safe' => ['html']]),
];
}
public function sanitize(string $html, ?string $sanitizer = null): string
{
return $this->sanitizers->get($sanitizer ?? $this->defaultSanitizer)->sanitize( | c function __construct(
private ContainerInterface $sanitizers,
private string $defaultSanitizer = 'default',
) {
}
public function getFilters(): array
{
return [
new TwigFilte | {
"filepath": "src/Symfony/Bridge/Twig/Extension/HtmlSanitizerExtension.php",
"language": "php",
"file_size": 1013,
"cut_index": 512,
"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\Bridge\Twig\Extension;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Compone... | rn [
new TwigFunction('absolute_url', $this->generateAbsoluteUrl(...)),
new TwigFunction('relative_path', $this->generateRelativePath(...)),
];
}
/**
* Returns the absolute URL for the given absolute or relativ | n@symfony.com>
*/
final class HttpFoundationExtension extends AbstractExtension
{
public function __construct(
private UrlHelper $urlHelper,
) {
}
public function getFunctions(): array
{
retu | {
"filepath": "src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php",
"language": "php",
"file_size": 1638,
"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\Bridge\Twig\Node;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use T... | nstruct(AbstractExpression $expr, int $lineno = 0)
{
parent::__construct(['expr' => $expr], [], $lineno);
}
public function compile(Compiler $compiler): void
{
// noop as this node is just a marker for TranslationDefaultDom | function __co | {
"filepath": "src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php",
"language": "php",
"file_size": 815,
"cut_index": 522,
"middle_length": 14
} |
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\Bridge\Twig\Extension;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
... | or = null,
) {
}
/**
* Renders a fragment.
*
* @see FragmentHandler::render()
*/
public function renderFragment(string|ControllerReference $uri, array $options = []): string
{
$strategy = $options['strategy' | *
* @author Fabien Potencier <fabien@symfony.com>
*/
final class HttpKernelRuntime
{
public function __construct(
private FragmentHandler $handler,
private ?FragmentUriGeneratorInterface $fragmentUriGenerat | {
"filepath": "src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php",
"language": "php",
"file_size": 1914,
"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\Bridge\Twig\Extension;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfo... | private ?Stopwatch $stopwatch = null,
) {
parent::__construct($profile);
$this->events = new \SplObjectStorage();
}
public function enter(Profile $profile): void
{
if ($this->stopwatch && $profile->isTemplate | class ProfilerExtension extends BaseProfilerExtension
{
/**
* @var \SplObjectStorage<Profile, StopwatchEvent>
*/
private \SplObjectStorage $events;
public function __construct(
Profile $profile,
| {
"filepath": "src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php",
"language": "php",
"file_size": 1417,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\Extension;
use Symfony\Component\Security\Acl\Voter\FieldVote;
use Symfony\Component\Security\Core\Authorization\AccessDecision;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Authoriza... | ymfony.com>
*/
final class SecurityExtension extends AbstractExtension
{
public function __construct(
private ?AuthorizationCheckerInterface $securityChecker = null,
private ?ImpersonateUrlGenerator $impersonateUrlGenerator = null,
| mfony\Component\Security\Http\Impersonate\ImpersonateUrlGenerator;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* SecurityExtension exposes security context features.
*
* @author Fabien Potencier <fabien@s | {
"filepath": "src/Symfony/Bridge/Twig/Extension/SecurityExtension.php",
"language": "php",
"file_size": 6268,
"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\Bridge\Twig\Extension;
use Symfony\Bridge\Twig\TokenParser\StopwatchT... |
public function getStopwatch(): Stopwatch
{
return $this->stopwatch;
}
/**
* @return TokenParserInterface[]
*/
public function getTokenParsers(): array
{
return [
/*
* {% stopwat | author Wouter J <wouter@wouterj.nl>
*/
final class StopwatchExtension extends AbstractExtension
{
public function __construct(
private ?Stopwatch $stopwatch = null,
private bool $enabled = true,
) {
} | {
"filepath": "src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php",
"language": "php",
"file_size": 1230,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\Extension;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\WebLink\GenericLinkProvider;
use Symfony\Component\WebLink\Link;
use ... | is->link(...)),
new TwigFunction('preload', $this->preload(...)),
new TwigFunction('dns_prefetch', $this->dnsPrefetch(...)),
new TwigFunction('preconnect', $this->preconnect(...)),
new TwigFunction('prefetch' | ion extends AbstractExtension
{
public function __construct(
private RequestStack $requestStack,
) {
}
public function getFunctions(): array
{
return [
new TwigFunction('link', $th | {
"filepath": "src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php",
"language": "php",
"file_size": 4207,
"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\Bridge\Twig\Extension;
use Symfony\Component\Yaml\Dumper as YamlDumper;
use... | ];
}
public function encode(mixed $input, int $inline = 0, int $dumpObjects = 0): string
{
static $dumper;
$dumper ??= new YamlDumper();
return $dumper->dump($input, $inline, 0, $dumpObjects);
}
public functi | tension extends AbstractExtension
{
public function getFilters(): array
{
return [
new TwigFilter('yaml_encode', $this->encode(...)),
new TwigFilter('yaml_dump', $this->dump(...)),
| {
"filepath": "src/Symfony/Bridge/Twig/Extension/YamlExtension.php",
"language": "php",
"file_size": 1390,
"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\Bridge\Twig\Mime;
use League\HTMLToMarkdown\HtmlConverterInterface;
use Symfony\Component\Mime\BodyRendererInterfa... | Fabien Potencier <fabien@symfony.com>
*/
final class BodyRenderer implements BodyRendererInterface
{
private HtmlToTextConverterInterface $converter;
public function __construct(
private Environment $twig,
private array $context = | lToTextConverterInterface;
use Symfony\Component\Mime\HtmlToTextConverter\LeagueHtmlToMarkdownConverter;
use Symfony\Component\Mime\Message;
use Symfony\Component\Translation\LocaleSwitcher;
use Twig\Environment;
/**
* @author | {
"filepath": "src/Symfony/Bridge/Twig/Mime/BodyRenderer.php",
"language": "php",
"file_size": 3038,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\Mime;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\Mime\Header\Headers;
use Symfony\Component\Mime\Part\AbstractPart;
use Symfony\Component\Mime\Part\DataPart;
use Twig\Extra\CssInliner\CssInlinerExtension;
use Twig... | = [
'importance' => self::IMPORTANCE_LOW,
'content' => '',
'exception' => false,
'action_text' => null,
'action_url' => null,
'markdown' => false,
'raw' => false,
'footer_text' => 'Notificati | t IMPORTANCE_URGENT = 'urgent';
public const IMPORTANCE_HIGH = 'high';
public const IMPORTANCE_MEDIUM = 'medium';
public const IMPORTANCE_LOW = 'low';
private string $theme = 'default';
private array $context | {
"filepath": "src/Symfony/Bridge/Twig/Mime/NotificationEmail.php",
"language": "php",
"file_size": 7769,
"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\Bridge\Twig\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollecto... | function __construct(
private Profile $profile,
private ?Environment $twig = null,
) {
}
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
}
public function reset( | er;
use Twig\Profiler\Profile;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class TwigDataCollector extends DataCollector implements LateDataCollectorInterface
{
private array $computed;
public | {
"filepath": "src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php",
"language": "php",
"file_size": 5026,
"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\Bridge\Twig\TokenParser;
use Symfony\Bridge\Twig\Node\DumpNode;
use Twig\Node\Expression... | : Node
{
$values = null;
if (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE)) {
$values = $this->parseMultitargetExpression();
}
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
re | *
* {% dump %}
* {% dump foo %}
* {% dump foo, bar %}
*
* @author Julien Galenski <julien.galenski@gmail.com>
*/
final class DumpTokenParser extends AbstractTokenParser
{
public function parse(Token $token) | {
"filepath": "src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php",
"language": "php",
"file_size": 1537,
"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\Bridge\Twig\TokenParser;
use Symfony\Bridge\Twig\Node\StopwatchNode;
use Twig\Node\Expre... | = $token->getLine();
$stream = $this->parser->getStream();
// {% stopwatch 'bar' %}
$name = $this->parser->parseExpression();
$stream->expect(Token::BLOCK_END_TYPE);
// {% endstopwatch %}
$body = $this->p | l>
*/
final class StopwatchTokenParser extends AbstractTokenParser
{
public function __construct(
private bool $stopwatchIsAvailable,
) {
}
public function parse(Token $token): Node
{
$lineno | {
"filepath": "src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php",
"language": "php",
"file_size": 1510,
"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\Bridge\Twig\TokenParser;
use Symfony\Bridge\Twig\Node\TransNode;
use Twig\Error\SyntaxError;
use Twig\Node\Express... | $stream = $this->parser->getStream();
$count = null;
$vars = new ArrayExpression([], $lineno);
$domain = null;
$locale = null;
if (!$stream->test(Token::BLOCK_END_TYPE)) {
if ($stream->test('count')) { | the 'trans' tag.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
final class TransTokenParser extends AbstractTokenParser
{
public function parse(Token $token): Node
{
$lineno = $token->getLine();
| {
"filepath": "src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php",
"language": "php",
"file_size": 2754,
"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\Bridge\Twig\Node;
use Symfony\Component\Form\FormRenderer;
use Twig\A... | compiler): void
{
$compiler
->addDebugInfo($this)
->write('$this->env->getRuntime(')
->string(FormRenderer::class)
->raw(')->setTheme(')
->subcompile($this->getNode('form'))
| __construct(Node $form, Node $resources, int $lineno, bool $only = false)
{
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno);
}
public function compile(Compiler $ | {
"filepath": "src/Symfony/Bridge/Twig/Node/FormThemeNode.php",
"language": "php",
"file_size": 1206,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\Node;
use Twig\Compiler;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FunctionExpressi... | $arguments = iterator_to_array($this->getNode('arguments'));
$blockNameSuffix = $matches[1];
if (isset($arguments[0])) {
$compiler->subcompile($arguments[0]);
$compiler->raw(', \''.$blockNameSuffix.'\'');
| $compiler->addDebugInfo($this);
$compiler->raw('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(');
preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches);
| {
"filepath": "src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php",
"language": "php",
"file_size": 4665,
"cut_index": 614,
"middle_length": 229
} |
nParser\FormThemeTokenParser;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Contracts\Translation\TranslatableInterface;
us... | e ?TranslatorInterface $translator = null,
) {
}
public function getTokenParsers(): array
{
return [
// {% form_theme form "SomeBundle::widgets.twig" %}
new FormThemeTokenParser(),
];
}
publ | h form capabilities.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
final class FormExtension extends AbstractExtension
{
public function __construct(
privat | {
"filepath": "src/Symfony/Bridge/Twig/Extension/FormExtension.php",
"language": "php",
"file_size": 10292,
"cut_index": 921,
"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\Bridge\Twig\Node;
use Twig\Compiler;
use Twig\Node\Expression\FunctionExpre... | ler->addDebugInfo($this);
$arguments = iterator_to_array($this->getNode('arguments'));
$compiler->write('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->renderBlock(');
if (isset($arguments[0])) {
$comp | foo", the block "foo" will be rendered.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
final class RenderBlockNode extends FunctionExpression
{
public function compile(Compiler $compiler): void
{
$compi | {
"filepath": "src/Symfony/Bridge/Twig/Node/RenderBlockNode.php",
"language": "php",
"file_size": 1306,
"cut_index": 524,
"middle_length": 229
} |
Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\RadioType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormError;
/**
* Abstract class providing test cases for the Boot... | w($form->get('name')->createView());
$this->assertMatchesXpath($html,
'/div
[@class="mb-3 row"]
[
./label
[@for="name"]
[@class="col-form-label col-sm-2 required"]
/following-sibling::div | se
{
public function testRow()
{
$form = $this->factory->createNamed('')->add('name', TextType::class);
$form->get('name')->addError(new FormError('[trans]Error![/trans]'));
$html = $this->renderRo | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap5HorizontalLayoutTestCase.php",
"language": "php",
"file_size": 10593,
"cut_index": 921,
"middle_length": 229
} |
tRow()
{
$form = $this->factory->createNamed('')->add('name', TextType::class);
$form->get('name')->addError(new FormError('[trans]Error![/trans]'));
$html = $this->renderRow($form->get('name')->createView());
$this->assertMatchesXpath($html,
'/div
[@class="mb-3"]
... | Error('[trans]Error![/trans]'));
$html = $this->renderRow($form->get('name')->createView(), [
'row_attr' => [
'class' => 'mb-5',
],
]);
$this->assertMatchesXpath($html,
'/div
| ans]"]
]
[count(./div)=1]
'
);
}
public function testRowWithCustomClass()
{
$form = $this->factory->createNamed('')->add('name', TextType::class);
$form->get('name')->addError(new Form | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap5LayoutTestCase.php",
"language": "php",
"file_size": 60885,
"cut_index": 2151,
"middle_length": 229
} |
l,
'/div
[
./label[@for="name"]
/following-sibling::ul
[./li[.="[trans]Error![/trans]"]]
[count(./li)=1]
/following-sibling::input[@id="name"]
]
'
);
}
public function testRowOverrideVariables()
{
$view = $this->factory->cr... | foo&bar[/trans]"]
/following-sibling::input[@id="name"][@class="my&class"]
]
'
);
}
public function testRepeatedRow()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\Repeate | bel' => 'foo&bar',
'label_attr' => ['class' => 'my&label&class'],
]);
$this->assertMatchesXpath($html,
'/div
[
./label[@for="name"][@class="my&label&class required"][.="[trans] | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractDivLayoutTestCase.php",
"language": "php",
"file_size": 33274,
"cut_index": 1331,
"middle_length": 229
} |
testLabelOnForm()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, ['widget' => 'choice']);
$view = $form->createView();
$this->renderWidget($view, ['label' => 'foo']);
$html = $this->renderLabel($view);
$this->asser... | ssertMatchesXpath($html,
'/label
[@for="name"]
[.="[trans]Custom label[/trans]"]
'
);
}
public function testLabelWithCustomTextPassedDirectly()
{
$form = $this->factory->createNamed('name', 'Symfony\Componen | rm = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
'label' => 'Custom label',
]);
$html = $this->renderLabel($form->createView());
$this->a | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php",
"language": "php",
"file_size": 91770,
"cut_index": 3790,
"middle_length": 229
} |
tCase extends AbstractLayoutTestCase
{
public function testRow()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($v... | alse()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
'label' => false,
]);
$html = $this->renderRow($form->createView());
$this->assertMatchesXp | [./li[.="[trans]Error![/trans]"]]
[count(./li)=1]
/following-sibling::input[@id="name"]
]
]
'
);
}
public function testLabelIsNotRenderedWhenSetToF | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractTableLayoutTestCase.php",
"language": "php",
"file_size": 17031,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Extension\DumpExtension;
use Symf... | $twig = new Environment(new ArrayLoader(['template' => $template]), [
'debug' => $debug,
'cache' => false,
'optimizations' => 0,
]);
$twig->addExtension($extension);
$dumped = null;
$exc | s DumpExtensionTest extends TestCase
{
#[DataProvider('getDumpTags')]
public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped)
{
$extension = new DumpExtension(new VarCloner());
| {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php",
"language": "php",
"file_size": 4842,
"cut_index": 614,
"middle_length": 229
} |
ackage.
*
* (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\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Attr... | )]
#[TestWith(['🅰', ':a:', 'github'])]
public function testEmojify(string $expected, string $string, ?string $catalog = null)
{
$extension = new EmojiExtension();
$this->assertSame($expected, $extension->emojify($string, $catalo | '🅰️', ':a:'])]
#[TestWith(['🅰️', ':a:', 'slack'] | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/EmojiExtensionTest.php",
"language": "php",
"file_size": 893,
"cut_index": 559,
"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\Bridge\Twig\Tests\Extension;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Extension\Exp... | ronment(new ArrayLoader(['template' => $template]), ['debug' => true, 'cache' => false, 'autoescape' => 'html', 'optimizations' => 0]);
$twig->addExtension(new ExpressionExtension());
$output = $twig->render('template');
$this->ass | { expression('1 == 1') }}";
$twig = new Envi | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.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\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormEx... | s/Form',
__DIR__.'/Fixtures/templates/form',
];
}
protected function getTwigExtensions(): array
{
return [
new TranslationExtension(new StubTranslator()),
new FormExtension(),
];
| tractBootstrap3HorizontalLayoutTestCase
{
protected array $testableFeatures = [
'choice_attr',
];
protected function getTemplatePaths(): array
{
return [
__DIR__.'/../../Resources/view | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php",
"language": "php",
"file_size": 1185,
"cut_index": 518,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\Tw... | ctory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, [
'method' => 'get',
'action' => '',
]);
$html = $this->renderStart($form->createView());
$this->assertSame('<form name="form" meth | onment;
use Twig\Loader\FilesystemLoader;
class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTestCase
{
public function testStartTagHasNoActionAttributeWhenActionIsEmpty()
{
$form = $this->fa | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php",
"language": "php",
"file_size": 3369,
"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\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormExtensio... |
];
protected function getTemplatePaths(): array
{
return [
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
];
}
protected function getTwigExtensions(): array
{
| me.
*
* @author Hidde Wieringa <hidde@hiddewieringa.nl>
*/
class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4HorizontalLayoutTestCase
{
protected array $testableFeatures = [
'choice_attr', | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php",
"language": "php",
"file_size": 1314,
"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\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\Tw... | s AbstractBootstrap4LayoutTestCase
{
public function testStartTagHasNoActionAttributeWhenActionIsEmpty()
{
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, [
'method' => 'get',
| onment;
use Twig\Loader\FilesystemLoader;
/**
* Class providing test cases for the Bootstrap 4 horizontal Twig form theme.
*
* @author Hidde Wieringa <hidde@hiddewieringa.nl>
*/
class FormExtensionBootstrap4LayoutTest extend | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php",
"language": "php",
"file_size": 3536,
"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\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormExtensio... | choice_attr',
];
protected function getTemplatePaths(): array
{
return [
__DIR__.'/../../Resources/views/Form',
__DIR__.'/Fixtures/templates/form',
];
}
protected function getTwigExtensions(): a | ig form theme.
*
* @author Romain Monteil <monteil.romain@gmail.com>
*/
class FormExtensionBootstrap5HorizontalLayoutTest extends AbstractBootstrap5HorizontalLayoutTestCase
{
protected array $testableFeatures = [
' | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5HorizontalLayoutTest.php",
"language": "php",
"file_size": 1327,
"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\Bridge\Twig\Tests\Extension;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Bridge\Twig\Form\Tw... | *
* @author Romain Monteil <monteil.romain@gmail.com>
*/
class FormExtensionBootstrap5LayoutTest extends AbstractBootstrap5LayoutTestCase
{
public function testStartTagHasNoActionAttributeWhenActionIsEmpty()
{
$form = $this->factory->cre | Type;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
* Class providing test cases for the Bootstrap 5 Twig form theme.
| {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php",
"language": "php",
"file_size": 3415,
"cut_index": 614,
"middle_length": 229
} |
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, ['widget' => 'choice']);
$view = $form->createView();
$this->renderWidget($view, ['label' => 'foo']);
$html = $this->renderLabel($view);
$this->assertMatchesXpath($html,
... | ]);
$this->assertMatchesXpath($html,
'/label
[@for="name"]
[@class="label required"]
'
);
}
public function testHelp()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extens | tory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, [
'attr' => [
'class' => 'my&class',
],
| {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDaisyUi5LayoutTest.php",
"language": "php",
"file_size": 27278,
"cut_index": 1331,
"middle_length": 229
} |
ension\TranslationExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Security\Csrf\CsrfToke... | $this->assertMatchesXpath(
$this->renderWidget($view),
'/input[@type="email"][@rel="theme"]'
);
}
public function testThemeBlockInheritanceUsingExtend()
{
$view = $this->factory
->createNam | {
$view = $this->factory
->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
$this->setTheme($view, ['theme_use.html.twig']);
| {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php",
"language": "php",
"file_size": 11475,
"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\Bridge\Twig\Translation;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Finder\Find... | m>
*/
class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface
{
/**
* Default domain for found messages.
*/
private string $defaultDomain = 'messages';
/**
* Prefix for found message.
*/
private | wig\Environment;
use Twig\Error\Error;
use Twig\Source;
/**
* TwigExtractor extracts translation messages from a twig template.
*
* @author Michel Salib <michelsalib@hotmail.com>
* @author Fabien Potencier <fabien@symfony.co | {
"filepath": "src/Symfony/Bridge/Twig/Translation/TwigExtractor.php",
"language": "php",
"file_size": 2508,
"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\Bridge\Twig\NodeVisitor;
/**
* @author Jean-François Simon <jeanfrancois.simon@sensiola... | his->left = true;
return $this->parent;
}
/**
* Stores data into current scope.
*
* @return $this
*
* @throws \LogicException
*/
public function set(string $key, mixed $value): static
{
if ($t | ens a new child scope.
*/
public function enter(): self
{
return new self($this);
}
/**
* Closes current scope and returns parent one.
*/
public function leave(): ?self
{
$t | {
"filepath": "src/Symfony/Bridge/Twig/NodeVisitor/Scope.php",
"language": "php",
"file_size": 1887,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\NodeVisitor;
use Symfony\Bridge\Twig\Node\TransNode;
use Twig\Environment;
use Twig\Node\Expression\Binary\ConcatBinary;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FilterExpression;
use Twig\Node\Expression\FunctionExpression;
u... | his->enabled = true;
$this->messages = [];
}
public function disable(): void
{
$this->enabled = false;
$this->messages = [];
}
public function getMessages(): array
{
return $this->messages;
}
| TranslationNodeVisitor implements NodeVisitorInterface
{
public const UNDEFINED_DOMAIN = '_undefined';
private bool $enabled = false;
private array $messages = [];
public function enable(): void
{
$t | {
"filepath": "src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php",
"language": "php",
"file_size": 6282,
"cut_index": 716,
"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\Bridge\Twig\Validator\Constraints;
use Symfony\Component\Validator... | LID_TWIG_ERROR',
];
#[HasNamedArguments]
public function __construct(
public string $message = 'This value is not a valid Twig template.',
public bool $skipDeprecations = true,
?array $groups = null,
mixed $payl | GET_METHOD | \Attribute::IS_REPEATABLE)]
class Twig extends Constraint
{
public const INVALID_TWIG_ERROR = 'e7fc55d5-e586-4cc1-924e-d27ee7fcd1b5';
protected const ERROR_NAMES = [
self::INVALID_TWIG_ERROR => 'INVA | {
"filepath": "src/Symfony/Bridge/Twig/Validator/Constraints/Twig.php",
"language": "php",
"file_size": 1082,
"cut_index": 515,
"middle_length": 229
} |
sole\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputArgument;
u... | and output encountered errors.
*
* @author Marc Weistroff <marc.weistroff@sensiolabs.com>
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
#[AsCommand(name: 'lint:twig', description: 'Lint a Twig template and outputs encountered errors')]
class Lin | mfonyStyle;
use Symfony\Component\Finder\Finder;
use Twig\Environment;
use Twig\Error\Error;
use Twig\Loader\ArrayLoader;
use Twig\Loader\FilesystemLoader;
use Twig\Source;
/**
* Command that will validate your template syntax | {
"filepath": "src/Symfony/Bridge/Twig/Command/LintCommand.php",
"language": "php",
"file_size": 11859,
"cut_index": 921,
"middle_length": 229
} |
use Symfony\Bridge\Twig\AppVariable;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Security\Core\Authentication\To... | ppVariable = new AppVariable();
}
#[DataProvider('debugDataProvider')]
public function testDebug($debugFlag)
{
$this->appVariable->setDebug($debugFlag);
$this->assertEquals($debugFlag, $this->appVariable->getDebug());
| ent\Security\Core\User\InMemoryUser;
use Symfony\Component\Translation\LocaleSwitcher;
class AppVariableTest extends TestCase
{
protected AppVariable $appVariable;
protected function setUp(): void
{
$this->a | {
"filepath": "src/Symfony/Bridge/Twig/Tests/AppVariableTest.php",
"language": "php",
"file_size": 10514,
"cut_index": 921,
"middle_length": 229
} |
html = $this->renderLabel($form->createView(), null, [
'label_attr' => [
'class' => 'my&class',
],
]);
$this->assertMatchesXpath($html, '/label[@for="name"][@class="my&class control-label required"][.="[trans]<b>Bolded label</b>[/trans]"]');
$this->assert... | iew(), null, [
'label_attr' => [
'class' => 'my&class',
],
]);
$this->assertMatchesXpath($html, '/label[@for="name"][@class="my&class control-label required"][.="[trans]<b>Bolded label</b>[/trans]"]' | ry->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
'label' => '<b>Bolded label</b>',
'label_html' => true,
]);
$html = $this->renderLabel($form->createV | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTestCase.php",
"language": "php",
"file_size": 96036,
"cut_index": 3790,
"middle_length": 229
} |
[./span[.="[trans]Error![/trans]"]]
]
[count(./span)=1]
/following-sibling::input[@id="name"]
]
'
);
}
public function testLabelOnForm()
{
$form = $this->factory->createNamed('name', DateType::class, null, ['widget' => 'choice']);
$view = $form... | his->renderLabel($form->createView(), null, [
'attr' => [
'class' => 'my&class',
],
]);
$this->assertMatchesXpath($html,
'/label
[@for="name"]
[@class="required"]
'
);
| ol-form-label required"]
[.="[trans]Name[/trans]"]
'
);
}
public function testLabelDoesNotRenderFieldAttributes()
{
$form = $this->factory->createNamed('name', TextType::class);
$html = $t | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap4LayoutTestCase.php",
"language": "php",
"file_size": 40016,
"cut_index": 2151,
"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\Bridge\Twig\Node;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Expres... | r' => $var], [], $lineno);
}
public function compile(Compiler $compiler): void
{
$compiler
->addDebugInfo($this)
->write('')
->subcompile($this->getNode('var'))
->raw(' = ')
- | ]
final class StopwatchNode extends Node
{
public function __construct(Node $name, Node $body, AssignNameExpression|LocalVariable $var, int $lineno = 0)
{
parent::__construct(['body' => $body, 'name' => $name, 'va | {
"filepath": "src/Symfony/Bridge/Twig/Node/StopwatchNode.php",
"language": "php",
"file_size": 1561,
"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\Bridge\Twig\Extension;
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
us... | new TwigFunction('logout_url', $this->getLogoutUrl(...)),
new TwigFunction('logout_path', $this->getLogoutPath(...)),
];
}
/**
* Generates the relative logout URL for the firewall.
*
* @param string|null $key T | final class LogoutUrlExtension extends AbstractExtension
{
public function __construct(
private LogoutUrlGenerator $generator,
) {
}
public function getFunctions(): array
{
return [
| {
"filepath": "src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php",
"language": "php",
"file_size": 1515,
"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\Bridge\Twig\Extension;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Twig\Extension\AbstractExtension;
use Twig\Node\Expression\ArrayExpression;... | return [
new TwigFunction('url', $this->getUrl(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
new TwigFunction('path', $this->getPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
];
}
| @symfony.com>
*/
final class RoutingExtension extends AbstractExtension
{
public function __construct(
private UrlGeneratorInterface $generator,
) {
}
public function getFunctions(): array
{
| {
"filepath": "src/Symfony/Bridge/Twig/Extension/RoutingExtension.php",
"language": "php",
"file_size": 3419,
"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\Bridge\Twig\Extension;
use Symfony\Component\Workflow\Registry;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\TransitionBlockerList;
use ... | new TwigFunction('workflow_can', $this->canTransition(...)),
new TwigFunction('workflow_transitions', $this->getEnabledTransitions(...)),
new TwigFunction('workflow_transition', $this->getEnabledTransition(...)),
new Twi | /
final class WorkflowExtension extends AbstractExtension
{
public function __construct(
private Registry $workflowRegistry,
) {
}
public function getFunctions(): array
{
return [
| {
"filepath": "src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php",
"language": "php",
"file_size": 3936,
"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\Bridge\Twig\Mime;
use Symfony\Component\Mime\Email;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
clas... | lTemplate(?string $template): static
{
$this->htmlTemplate = $template;
return $this;
}
/**
* @return $this
*/
public function locale(?string $locale): static
{
$this->locale = $locale;
retur | **
* @return $this
*/
public function textTemplate(?string $template): static
{
$this->textTemplate = $template;
return $this;
}
/**
* @return $this
*/
public function htm | {
"filepath": "src/Symfony/Bridge/Twig/Mime/TemplatedEmail.php",
"language": "php",
"file_size": 2346,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\Form;
use Symfony\Component\Form\AbstractRendererEngine;
use Symfony\Component\Form\FormView;
use Twig\Environment;
use Twig\Template;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class TwigRendererEngine extends AbstractRendererEngine
{
... | t->getGlobals();
ob_start();
// By contract,This method can only be called after getting the resource
// (which is passed to the method). Getting a resource for the first time
// (with an empty cache) is guaranteed to invo | }
public function renderBlock(FormView $view, mixed $resource, string $blockName, array $variables = []): string
{
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
$context = $variables + $this->environmen | {
"filepath": "src/Symfony/Bridge/Twig/Form/TwigRendererEngine.php",
"language": "php",
"file_size": 7215,
"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\Bridge\Twig\Node;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Expression\Variable\LocalVariabl... | o);
}
public function compile(Compiler $compiler): void
{
if ($this->varPrefix instanceof LocalVariable) {
$varPrefix = $this->varPrefix->getAttribute('name');
} else {
$varPrefix = $this->varPrefix;
| ariable|string $varPrefix,
?Node $values,
int $lineno,
) {
$nodes = [];
if (null !== $values) {
$nodes['values'] = $values;
}
parent::__construct($nodes, [], $linen | {
"filepath": "src/Symfony/Bridge/Twig/Node/DumpNode.php",
"language": "php",
"file_size": 3000,
"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\Bridge\Twig\NodeVisitor;
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
use Symfony\Bridge\Twig\Node\TransNode;
use Twig\Environment;
use Twig\Node\BlockNode;
... | tencier <fabien@symfony.com>
*/
final class TranslationDefaultDomainNodeVisitor implements NodeVisitorInterface
{
private Scope $scope;
public function __construct()
{
$this->scope = new Scope();
}
public function enterNode(N | ignContextVariable;
use Twig\Node\Expression\Variable\ContextVariable;
use Twig\Node\ModuleNode;
use Twig\Node\Node;
use Twig\Node\Nodes;
use Twig\Node\SetNode;
use Twig\NodeVisitor\NodeVisitorInterface;
/**
* @author Fabien Po | {
"filepath": "src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php",
"language": "php",
"file_size": 3969,
"cut_index": 614,
"middle_length": 229
} |
erface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Symfony\Component\Finder\Finder;
use Twig\Environment;
use Twig\Loader\ChainLoader;
use Twig\Loader\FilesystemLoader;
/**
* Lists twig functions, filters, globals and tests present in the ... | private array $bundlesMetadata = [],
private ?string $twigDefaultPath = null,
private ?FileLinkFormatter $fileLinkFormatter = null,
) {
parent::__construct();
}
protected function configure(): void
{
$this
| mand extends Command
{
/**
* @var FilesystemLoader[]
*/
private array $filesystemLoaders;
public function __construct(
private Environment $twig,
private ?string $projectDir = null,
| {
"filepath": "src/Symfony/Bridge/Twig/Command/DebugCommand.php",
"language": "php",
"file_size": 21025,
"cut_index": 1331,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\Tests\Extension;
abstract class AbstractBootstrap3HorizontalLayoutTestCase extends AbstractBootstrap3LayoutTestCase
{
public function testLabelOnForm()
{
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Ty... | $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, [
'attr' => [
'class' => 'my&class',
],
]);
| his->assertMatchesXpath($html,
'/label
[@class="col-sm-2 control-label required"]
[.="[trans]Name[/trans]"]
'
);
}
public function testLabelDoesNotRenderFieldAttributes()
{
$form = | {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3HorizontalLayoutTestCase.php",
"language": "php",
"file_size": 7513,
"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\Bridge\Twig\Extension;
use Symfony\Component\HttpKernel\Controller\Controll... | ]]),
new TwigFunction('render_*', [HttpKernelRuntime::class, 'renderFragmentStrategy'], ['is_safe' => ['html']]),
new TwigFunction('fragment_uri', [HttpKernelRuntime::class, 'generateFragmentUri']),
new TwigFunction('con | nal class HttpKernelExtension extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction('render', [HttpKernelRuntime::class, 'renderFragment'], ['is_safe' => ['html' | {
"filepath": "src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php",
"language": "php",
"file_size": 1277,
"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\Bridge\Twig\Extension;
use Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor;
use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor;
use Symfo... | opcache.preload discover always-needed symbols
class_exists(TranslatorInterface::class);
class_exists(TranslatorTrait::class);
/**
* Provides integration of the Translation component with Twig.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
fina | nslation\TranslatableInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Contracts\Translation\TranslatorTrait;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
// Help | {
"filepath": "src/Symfony/Bridge/Twig/Extension/TranslationExtension.php",
"language": "php",
"file_size": 4744,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Twig\Mime;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Mime\Part\File;
use Twig\Environment;
/**
* @internal
*
* @author Fabien Potencier <fabien@symfony.com>
*/
final class WrappedTemplatedEmail
{
... | /images/logo.png').
* @param string|null $contentType The media type (i.e. MIME type) of the image file (e.g. 'image/png').
* Some email clients require this to display embedded images.
* @param string|null $n | age->getTo()[0]->getName();
}
/**
* @param string $image A Twig path to the image file. It's recommended to define
* some Twig namespace for email images (e.g. '@email | {
"filepath": "src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php",
"language": "php",
"file_size": 5125,
"cut_index": 716,
"middle_length": 229
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\TokenParser;
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
use Twig\Node\Node;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
... | $expr = $this->parser->parseExpression();
$this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
return new TransDefaultDomainNode($expr, $token->getLine());
}
public function getTag(): string
{
return 'trans_defa | ic function parse(Token $token): Node
{
| {
"filepath": "src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php",
"language": "php",
"file_size": 935,
"cut_index": 606,
"middle_length": 52
} |
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\Bridge\Twig\Validator\Constraints;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Con... | }
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof Twig) {
throw new UnexpectedTypeException($constraint, Twig::class);
}
if (null === $value || '' === $value) | ror;
use Twig\Loader\ArrayLoader;
use Twig\Source;
/**
* @author Mokhtar Tlili <tlili.mokhtar@gmail.com>
*/
class TwigValidator extends ConstraintValidator
{
public function __construct(private Environment $twig)
{
| {
"filepath": "src/Symfony/Bridge/Twig/Validator/Constraints/TwigValidator.php",
"language": "php",
"file_size": 2757,
"cut_index": 563,
"middle_length": 229
} |
ng test cases for the Bootstrap 4 horizontal Twig form theme.
*
* @author Hidde Wieringa <hidde@hiddewieringa.nl>
*/
abstract class AbstractBootstrap4HorizontalLayoutTestCase extends AbstractBootstrap4LayoutTestCase
{
public function testLabel()
{
$form = $this->factory->createNamed('name', 'Symfony\... | $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
'translation_domain' => false,
]);
$this->assertMatchesXpath($this->renderLabel($form->createView()),
' | $this->assertMatchesXpath($html,
'/div
[@class="col-sm-2"]
[./label
[@for="name"]
[.="[trans]Name[/trans]"]
]
'
);
}
public function testLabelWithoutTranslation()
{
| {
"filepath": "src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap4HorizontalLayoutTestCase.php",
"language": "php",
"file_size": 15851,
"cut_index": 921,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.