prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
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\Uid;
/**
* A v1 UUID contains a 60-bit timestamp and 62 extra unique bits.
*
* @author Grégoire Pinea... | e(): \DateTimeImmutable
{
return BinaryUtil::hexToDateTime('0'.substr($this->uid, 15, 3).substr($this->uid, 9, 4).substr($this->uid, 0, 8));
}
public function getNode(): string
{
return substr($this->uid, -12);
}
p | ring $uuid = null)
{
if (null === $uuid) {
$this->uid = strtolower(uuid_create(static::TYPE));
} else {
parent::__construct($uuid, true);
}
}
public function getDateTim | {
"filepath": "src/Symfony/Component/Uid/UuidV1.php",
"language": "php",
"file_size": 2419,
"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\DependencyInjection\Config;
use Symfony\Component\Config\Re... | ourceInterface $metadata): bool
{
return $metadata instanceof ContainerParametersResource;
}
public function isFresh(ResourceInterface $resource, int $timestamp): bool
{
foreach ($resource->getParameters() as $key => $value | hausser@gmail.com>
*/
class ContainerParametersResourceChecker implements ResourceCheckerInterface
{
public function __construct(
private ContainerInterface $container,
) {
}
public function supports(Res | {
"filepath": "src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php",
"language": "php",
"file_size": 1199,
"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\Component\DependencyInjection\Tests\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Depende... | raphvizDumper($container = new ContainerBuilder());
$this->assertStringEqualsGeneratedFile('services1.dot', $dumper->dump(), '->dump() dumps an empty container as an empty dot file');
$container = include self::$fixturesPath.'/containers/ | protected static string $fixturesPath;
public static function setUpBeforeClass(): void
{
self::$fixturesPath = realpath(__DIR__.'/../Fixtures');
}
public function testDump()
{
$dumper = new G | {
"filepath": "src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php",
"language": "php",
"file_size": 4145,
"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\WebLink\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\HttpHeaderParser;
class HttpHe... | ;
$links = $provider->getLinks();
self::assertCount(5, $links);
self::assertSame(['prerender'], $links[0]->getRels());
self::assertSame('/1', $links[0]->getHref());
self::assertSame([], $links[0]->getAttributes()); | h"; pr="0.7",</3>; rel="preload"; as="script"',
'</4>; rel="preload"; as="image"; nopush,</5>; rel="alternate next"; hreflang="fr"; hreflang="de"; title="Hello"',
];
$provider = $parser->parse($header) | {
"filepath": "src/Symfony/Component/WebLink/Tests/HttpHeaderParserTest.php",
"language": "php",
"file_size": 3710,
"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\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DnsMock;
class DnsMockTest extends TestCase
{
protected function tearDown(): vo... | ple.com', 'a'));
$this->assertTrue(DnsMock::checkdnsrr('example.com', 'any'));
$this->assertFalse(DnsMock::checkdnsrr('foobar.com', 'ANY'));
}
public function testGetmxrr()
{
DnsMock::withMockedHosts([
'exam | rue(DnsMock::checkdnsrr('example.com'));
DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]);
$this->assertFalse(DnsMock::checkdnsrr('example.com'));
$this->assertTrue(DnsMock::checkdnsrr('exam | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php",
"language": "php",
"file_size": 4375,
"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\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClassExistsMock;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\ExistingEnum;
use Symfony... | withMockedEnums([
ExistingEnum::class => false,
'NonExistingEnum' => true,
]);
}
public static function tearDownAfterClass(): void
{
ClassExistsMock::withMockedEnums([]);
}
public function testC | llow PHP to be fully aware of the enum existence
require __DIR__.'/Fixtures/ExistingEnumReal.php';
ClassExistsMock::register(__CLASS__);
}
protected function setUp(): void
{
ClassExistsMock:: | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/EnumExistsMockTest.php",
"language": "php",
"file_size": 3225,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
us... | $this->expectDeprecation('foo');
@trigger_error('foo', \E_USER_DEPRECATED);
}
/**
* Do not remove this test in the next major version.
*
* @group legacy
*
* @runInSeparateProcess
*/
#[Group('legacy') | tionTraitTest extends TestCase
{
use ExpectDeprecationTrait;
/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne()
{
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/ExpectDeprecationTraitTest.php",
"language": "php",
"file_size": 2482,
"cut_index": 563,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\Group;
use ... | ED);
}
/**
* Do not remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation foo
* @expectedDeprecation bar
*/
#[Group('legacy')]
public function testMany()
{
@t | not remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation foo
*/
#[Group('legacy')]
public function testOne()
{
@trigger_error('foo', \E_USER_DEPRECAT | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php",
"language": "php",
"file_size": 1100,
"cut_index": 515,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExte... | ot remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation unreachable
*/
#[Group('legacy')]
public function testExpectingOnlyDeprecations()
{
$this->fail('should never be ran.'); | onSkippedTest extends TestCase
{
/**
* Do n | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/OnlyExpectingDeprecationSkippedTest.php",
"language": "php",
"file_size": 876,
"cut_index": 559,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\Group;
use PHP... | @trigger_error('Test abc', \E_USER_DEPRECATED);
$this->addToAssertionCount(1);
}
public function testCallingOtherErrorHandler()
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('Test tha | *
* @runTestsInSeparateProcesses
*/
#[RequiresPhpunit('<10.0.0')]
#[Group('legacy')]
class ProcessIsolationTest extends TestCase
{
/**
* @expectedDeprecation Test abc
*/
public function testIsolation()
{
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php",
"language": "php",
"file_size": 1134,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpU... | ce as of its next major version. You should not extend it from "%s".', FinalClass::class, ClassExtendingFinalClass::class));
new ClassExtendingFinalClass();
}
#[DataProvider('mockedNamespaces')]
#[Group('time-sensitive')]
#[TimeSe | Foo\A')]
class SymfonyExtension extends TestCase
{
public function testExtensionOfFinalClass()
{
$this->expectUserDeprecationMessage(\sprintf('The "%s" class is considered final. It may change without further noti | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtension.php",
"language": "php",
"file_size": 5605,
"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\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClockMo... | 3.4'],
],
]);
}
public static function tearDownAfterClass(): void
{
ClockMock::withClockMock(false);
DnsMock::withMockedHosts([]);
}
public function testDate()
{
self::assertSame('2024-0 | :class);
ClockMock::withClockMock(strtotime('2024-05-20 15:30:00'));
DnsMock::register(self::class);
DnsMock::withMockedHosts([
'example.com' => [
['type' => 'A', 'ip' => '1.2. | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/SymfonyExtensionWithManualRegister.php",
"language": "php",
"file_size": 1550,
"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.
*/
use Symfony\Bridge\PhpUnit\Tests\Fixtures\symfonyextension\src\ClassExtendingFinalClass;
use S... | Attribute/DnsSensitive.php';
require __DIR__.'/../../../../Attribute/TimeSensitive.php';
require __DIR__.'/../../../../Extension/EnableClockMockSubscriber.php';
require __DIR__.'/../../../../Extension/RegisterClockMockSubscriber.php';
require __DIR__.'/../ | lass.php';
} elseif (ClassExtendingFinalClass::class === $class) {
require __DIR__.'/../src/ClassExtendingFinalClass.php';
}
});
require __DIR__.'/../../../../SymfonyExtension.php';
require __DIR__.'/../../../../ | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/Fixtures/symfonyextension/tests/bootstrap.php",
"language": "php",
"file_size": 1393,
"cut_index": 524,
"middle_length": 229
} |
ishValue()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('hi');
Configuration::fromUrlEncodedString('hi');
}
public function testItThrowsOnUnknownConfigurationOption()
{
$this->expectException(\InvalidArgumentException::class);... | $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('forty-two');
Configuration::fromUrlEncodedString('max[total]=forty-two');
}
public function testItNoticesExceededTotalThreshold()
{
| pectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('deep');
Configuration::fromUrlEncodedString('max[deep]=42');
}
public function testItThrowsOnStringishThreshold()
{
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php",
"language": "php",
"file_size": 23921,
"cut_index": 1331,
"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\PhpUnit\Tests\DeprecationErrorHandler;
use PHPUnit\Framework\Attribu... | ller',
'get5klocMethod'
);
$group->addNoticeFromProceduralCode('Calling sfContext::getInstance() is deprecated');
$this->assertCount(1, $group->notices());
$this->assertSame(2, $group->count());
}
public | s TestCase
{
public function testItGroupsByMessage()
{
$group = new DeprecationGroup();
$group->addNoticeFromObject(
'Calling sfContext::getInstance() is deprecated',
'MonsterContro | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationGroupTest.php",
"language": "php",
"file_size": 1262,
"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\PhpUnit\Tests\DeprecationErrorHandler;
use PHPUnit\Framework\Attributes\RequiresP... | tice->addObjectOccurrence('MyOtherAction', '__invoke');
$countsByCaller = $notice->getCountsByCaller();
$this->assertCount(2, $countsByCaller);
$this->assertArrayHasKey('MyAction::__invoke', $countsByCaller);
$this->assert | {
public function testItGroupsByCaller()
{
$notice = new DeprecationNotice();
$notice->addObjectOccurrence('MyAction', '__invoke');
$notice->addObjectOccurrence('MyAction', '__invoke');
$no | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationNoticeTest.php",
"language": "php",
"file_size": 1546,
"cut_index": 537,
"middle_length": 229
} |
it\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7;
#[RequiresPhpunit('<10.0.0')]
class DeprecationTest extends TestCase
{
private static $vendorDir;
private stati... | if (file_exists($vendorDir.'/composer/installed.json') && @mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0o777, true)) {
break;
}
}
}
self::$vendorDir = $vendorDir;
@mkdir( | ses() as $class) {
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$vendorDir = \dirname($r->getFileName(), 2);
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php",
"language": "php",
"file_size": 11380,
"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.
*/
class ComposerLoaderFakeFallbackPsr0
{
public function getPrefixes()
{
r... | '.php';
if (file_exists($file)) {
require $file;
return;
}
}
}
}
class ComposerAutoloaderInitFakeFallbackPsr0
{
private static $loader;
public static function getLoader()
{
| public function getFallbackDirsPsr4()
{
return [];
}
public function loadClass($className)
{
foreach ($this->getFallbackDirs() as $dir) {
$file = $dir.strtr($className, '\\', '/'). | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_fallback_psr0/composer/autoload_real.php",
"language": "php",
"file_size": 1221,
"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.
*/
class ComposerLoaderFakeBis
{
public function getPrefixes()
{
return [];
}... | ts_with($className, $prefix)) {
continue;
}
foreach ($baseDirs as $baseDir) {
$file = str_replace([$prefix, '\\'], [$baseDir, '/'], $className.'.php');
if (file_exists($file)) {
| n [];
}
public function getFallbackDirsPsr4()
{
return [];
}
public function loadClass($className)
{
foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) {
if (!str_star | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_bis/composer/autoload_real.php",
"language": "php",
"file_size": 1411,
"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 App\Services;
use acme\lib\SomeService;
use foo\lib\SomeOtherService;
final class AppService
{
... | %s is deprecated, use %s_new instead.', ...$args));
} else {
@trigger_error(\sprintf('Since App 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED);
}
}
public function directDeprecation(bool $us | e2->deprecatedApi();
}
public function selfDeprecation(bool $useContracts = false)
{
$args = [__FUNCTION__, __FUNCTION__];
if ($useContracts) {
trigger_deprecation('App', '3.0', \sprintf(' | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_app/AppService.php",
"language": "php",
"file_size": 1527,
"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.
*/
class ComposerLoaderFake
{
public function getPrefixes()
{
return [];
}
public fun... | urn [];
}
public function loadClass($className)
{
if ($file = $this->findFile($className)) {
require $file;
}
}
public function findFile($class)
{
foreach ($this->getPrefixesPsr4() as $prefix => | > [__DIR__.'/../bar/lib/'],
'fcy\\lib\\' => [__DIR__.'/../fcy/lib/'],
];
}
public function getFallbackDirs()
{
return [];
}
public function getFallbackDirsPsr4()
{
ret | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/composer/autoload_real.php",
"language": "php",
"file_size": 1727,
"cut_index": 537,
"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 acme\lib;
use bar\lib\AnotherService;
class SomeService
{
public function deprecatedApi(bool $useContracts = fals... | rintf('Since acme/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED);
}
}
public function indirectDeprecatedApi(bool $useContracts = false)
{
(new AnotherService())->deprecatedApi($useContracts);
| s));
} else {
@trigger_error(\sp | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/SomeService.php",
"language": "php",
"file_size": 873,
"cut_index": 559,
"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.
*/
eval(<<<'EOPHP'
namespace PHPUnit\Util;
class Test
{
public static ... | D);
trigger_error('unsilenced foo deprecation', \E_USER_DEPRECATED);
}
public function testNonLegacyBar()
{
@trigger_error('silenced bar deprecation', \E_USER_DEPRECATED);
trigger_error('unsilenced bar deprecation', \E_ | gacyFoo()
{
@trigger_error('silenced foo deprecation', \E_USER_DEPRECATED);
trigger_error('unsilenced foo deprecation', \E_USER_DEPRECATED);
@trigger_error('silenced foo deprecation', \E_USER_DEPRECATE | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php",
"language": "php",
"file_size": 1217,
"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.
*/
class ComposerLoaderFakeFallbackPsr4
{
public function getPrefixes()
{
r... | /').'.php';
if (file_exists($file)) {
require $file;
return;
}
}
}
}
class ComposerAutoloaderInitFakeFallbackPsr4
{
private static $loader;
public static function getLoader()
| Psr4()
{
return [__DIR__.'/../../fake_app_fallback/'];
}
public function loadClass($className)
{
foreach ($this->getFallbackDirsPsr4() as $dir) {
$file = $dir.strtr($className, '\\', ' | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor_fallback_psr4/composer/autoload_real.php",
"language": "php",
"file_size": 1225,
"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\Bridge\PhpUnit\Tests\FailTests;
use PHPUnit\Framework\Attributes\Group;
use... | .0.0')]
final class ExpectDeprecationTraitTestFail extends TestCase
{
use ExpectDeprecationTrait;
/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne( | Class ExpectDeprecationTraitTestFail.
*
* This class is deliberately suffixed with *TestFail.php so that it is ignored
* by PHPUnit. This test is designed to fail. See ../expectdeprecationfail.phpt.
*/
#[RequiresPhpunit('<10 | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/FailTests/ExpectDeprecationTraitTestFail.php",
"language": "php",
"file_size": 1452,
"cut_index": 524,
"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\PhpUnit\Tests\FailTests;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCa... | 0')]
final class NoAssertionsTestNotRisky extends TestCase
{
use ExpectDeprecationTrait;
/**
* Do not remove this test in the next major version.
*/
public function testOne()
{
$this->expectNotToPerformAssertions();
} | ./expectnotrisky.phpt.
*/
#[RequiresPhpunit('<10.0. | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/FailTests/NoAssertionsTestNotRisky.php",
"language": "php",
"file_size": 870,
"cut_index": 559,
"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\PhpUnit\Tests\FailTests;
use PHPUnit\Framework\Attributes\Grou... | * Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne()
{
$this->expectNotToPerformAssertions();
$this->expectDeprecation('foo');
@trigge | sky.php so that it is ignored
* by PHPUnit. This test is designed to fail. See ../expectrisky.phpt.
*/
#[RequiresPhpunit('<10.0.0')]
final class NoAssertionsTestRisky extends TestCase
{
use ExpectDeprecationTrait;
/**
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/FailTests/NoAssertionsTestRisky.php",
"language": "php",
"file_size": 1211,
"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\PhpUnit\Tests\Metadata;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive;
use ... | = new AttributeReader();
$attributes = $reader->forClassAndMethod(FooBar::class, $method, $attributeClass);
self::assertContainsOnlyInstancesOf($attributeClass, $attributes);
self::assertSame($expected, array_column($attributes, ' | ds TestCase
{
/**
* @dataProvider provideReadCases
*/
#[DataProvider('provideReadCases')]
public function testAttributesAreRead(string $method, string $attributeClass, array $expected)
{
$reader | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/Metadata/AttributeReaderTest.php",
"language": "php",
"file_size": 3180,
"cut_index": 614,
"middle_length": 229
} |
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\PhpUnit\Tests\Metadata\Fixtures;
use Symfony\Bridge\PhpUnit\Attribute\DnsSensit... | )
{
}
#[TimeSensitive('App\Foo\Qux\D')]
#[TimeSensitive('App\Foo\Qux\E')]
public function testTwo()
{
}
#[DnsSensitive('App\Foo\Corge\F')]
#[TimeSensitive('App\Foo\Corge\G')]
public function testThree()
{
} | itive('App\Foo\Baz\C')]
public function testOne( | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/Metadata/Fixtures/FooBar.php",
"language": "php",
"file_size": 846,
"cut_index": 535,
"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\PhpUnit\Metadata;
/**
* @internal
*
* @template T of object
*/
final class AttributeReader
{
/**
... | ttributes[$name] ?? [];
}
/**
* @param class-string $className
* @param class-string<T> $name
*
* @return list<T>
*/
public function forMethod(string $className, string $methodName, string $name): array
{
| * @return list<T>
*/
public function forClass(string $className, string $name): array
{
$attributes = $this->cache[$className] ??= $this->readAttributes(new \ReflectionClass($className));
return $a | {
"filepath": "src/Symfony/Bridge/PhpUnit/Metadata/AttributeReader.php",
"language": "php",
"file_size": 2077,
"cut_index": 563,
"middle_length": 229
} |
name = null;
$getPhpUnitConfig = static function ($probableConfig) use (&$getPhpUnitConfig) {
if (!$probableConfig) {
return null;
}
if (is_dir($probableConfig)) {
return $getPhpUnitConfig($probableConfig.\DIRECTORY_SEPARATOR.'phpunit');
... | g option
if ('--configuration' === $cliArgument && array_key_exists($cliArgumentIndex + 1, $argv)) {
$phpunitConfigFilename = $getPhpUnitConfig($argv[$cliArgumentIndex + 1]);
break;
}
// s | }
}
return null;
};
foreach ($argv as $cliArgumentIndex => $cliArgument) {
if ('--' === $cliArgument) {
break;
}
// lon | {
"filepath": "src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php",
"language": "php",
"file_size": 19029,
"cut_index": 1331,
"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\Monolog\Processor;
use Monolog\LogRecord;
use Symfony\Component\Security\Core\Aut... | protected TokenStorageInterface $tokenStorage,
) {
}
abstract protected function getKey(): string;
abstract protected function getToken(): ?TokenInterface;
public function __invoke(LogRecord $record): LogRecord
{
if ($th | ny Maillard <danymaillard93b@gmail.com>
* @author Igor Timoshenko <igor.timoshenko@i.ua>
*
* @internal
*/
abstract class AbstractTokenProcessor
{
private bool $processing = false;
public function __construct(
| {
"filepath": "src/Symfony/Bridge/Monolog/Processor/AbstractTokenProcessor.php",
"language": "php",
"file_size": 1641,
"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\Monolog\Processor;
use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Sy... | nterface
{
private array $commandData;
public function __construct(
private bool $includeArguments = true,
private bool $includeOptions = false,
) {
}
public function __invoke(LogRecord $record): LogRecord
{
| rface;
/**
* Adds the current console command information to the log entry.
*
* @author Piotr Stankowski <git@trakos.pl>
*/
final class ConsoleCommandProcessor implements EventSubscriberInterface, ResetInterface, ResettableI | {
"filepath": "src/Symfony/Bridge/Monolog/Processor/ConsoleCommandProcessor.php",
"language": "php",
"file_size": 1865,
"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\Monolog\Processor;
use Monolog\Level;
use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Symfony\C... | stStack = null,
) {
}
public function __invoke(LogRecord $record): LogRecord
{
$key = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_id($request) : '';
$this->records[$key][] = [
| ass DebugProcessor implements DebugLoggerInterface, ResetInterface, ResettableInterface
{
private array $records = [];
private array $errorCount = [];
public function __construct(
private ?RequestStack $reque | {
"filepath": "src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php",
"language": "php",
"file_size": 2439,
"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\Monolog\Processor;
use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Symfony\Component\EventDispa... | esetInterface, ResettableInterface
{
private array $routeData = [];
public function __construct(
private bool $includeParams = true,
) {
$this->reset();
}
public function __invoke(LogRecord $record): LogRecord
{
| se Symfony\Contracts\Service\ResetInterface;
/**
* Adds the current route information to the log entry.
*
* @author Piotr Stankowski <git@trakos.pl>
*
* @final
*/
class RouteProcessor implements EventSubscriberInterface, R | {
"filepath": "src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php",
"language": "php",
"file_size": 2386,
"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\Bridge\Monolog\Processor;
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
use Symfony\Component\Security\Co... | tion getKey(): string
{
return 'impersonator_token';
}
protected function getToken(): ?TokenInterface
{
$token = $this->tokenStorage->getToken();
if ($token instanceof SwitchUserToken) {
return $token-> | extends AbstractTokenProcessor
{
protected func | {
"filepath": "src/Symfony/Bridge/Monolog/Processor/SwitchUserTokenProcessor.php",
"language": "php",
"file_size": 950,
"cut_index": 582,
"middle_length": 52
} |
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\WebLink\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\H... | e('pr', 0.7),
(new Link('preload', '/3'))->withAttribute('as', 'script')->withAttribute('nopush', false),
(new Link('preload', '/4'))->withAttribute('as', 'image')->withAttribute('nopush', true),
(new Link('alternate', ' | {
$this->serializer = new HttpHeaderSerializer();
}
public function testSerialize()
{
$links = [
new Link('prerender', '/1'),
(new Link('dns-prefetch', '/2'))->withAttribut | {
"filepath": "src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php",
"language": "php",
"file_size": 1877,
"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\WebLink\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfon... | $this->assertContains('next', $link->getRels());
$this->assertArrayHasKey('me', $link->getAttributes());
$this->assertSame('you', $link->getAttributes()['me']);
}
public function testCanRemoveValues()
{
$link = (new L | $link = (new Link())
->withHref('http://www.google.com')
->withRel('next')
->withAttribute('me', 'you')
;
$this->assertSame('http://www.google.com', $link->getHref());
| {
"filepath": "src/Symfony/Component/WebLink/Tests/LinkTest.php",
"language": "php",
"file_size": 2887,
"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\PhpUnit;
/**
* @author Nicolas Grekas <p@tchwork.com>
* @author Dominic Tubach <dominic.tubach@to.com>
*/
class ClockMock
{
private static $now;
p... | now;
}
public static function sleep($s): int
{
if (null === self::$now) {
return \sleep($s);
}
self::$now += (int) $s;
return 0;
}
public static function usleep($us): void
{
if | float) $enable : ($enable ? microtime(true) : null);
return null;
}
public static function time(): int
{
if (null === self::$now) {
return \time();
}
return (int) self::$ | {
"filepath": "src/Symfony/Bridge/PhpUnit/ClockMock.php",
"language": "php",
"file_size": 3963,
"cut_index": 614,
"middle_length": 229
} |
HPUnit\Util\ErrorHandler as UtilErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup;
use Symfony\Component\ErrorHandler\DebugClassLoader;
/**
* Catch deprecat... | nGroups = [];
private static $isRegistered = false;
private static $errorHandler;
public function __construct()
{
$this->resetDeprecationGroups();
}
/**
* Registers and configures the deprecation handler.
*
| ';
public const MODE_WEAK = 'max[total]=999999&verbose=0';
public const MODE_STRICT = 'max[total]=0';
private $mode;
private $configuration;
/**
* @var DeprecationGroup[]
*/
private $deprecatio | {
"filepath": "src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php",
"language": "php",
"file_size": 16580,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\PhpUnit;
use Doctrine\Deprecations\Deprecation;
use PHPUnit\Event\Code\Test;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Event\Test\BeforeTestMethodErrored;
use PHPUnit\Event\Test\BeforeTestMethodErroredSubscriber;
use PHPUnit\Event\Test\Errored;
use PHPUni... | \DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpUnit\Extension\EnableClockMockSubscriber;
use Symfony\Bridge\PhpUnit\Extension\RegisterClockMockSubscriber;
use Symfony\Bridge\PhpUnit\Extension\RegisterDnsMockSubscri | t\Metadata\Group;
use PHPUnit\Runner\Extension\Extension;
use PHPUnit\Runner\Extension\Facade;
use PHPUnit\Runner\Extension\ParameterCollection;
use PHPUnit\TextUI\Configuration\Configuration;
use Symfony\Bridge\PhpUnit\Attribute | {
"filepath": "src/Symfony/Bridge/PhpUnit/SymfonyExtension.php",
"language": "php",
"file_size": 6160,
"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.
*/
use Doctrine\Deprecations\Deprecation;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandle... | OMPOSER_INSTALL') && !class_exists(PHPUnit\TextUI\Command::class, false)) {
return;
}
if (isset($fileIdentifier)) {
unset($GLOBALS['__composer_autoload_files'][$fileIdentifier]);
}
if (class_exists(Deprecation::class)) {
Deprecation::withoutD | 'cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
DeprecationErrorHandler::collectDeprecations($file);
return;
}
// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_C | {
"filepath": "src/Symfony/Bridge/PhpUnit/bootstrap.php",
"language": "php",
"file_size": 1162,
"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\Bridge\PhpUnit\Extension;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Ev... | lic function notify(Loaded $event): void
{
foreach ($event->testSuite()->tests() as $test) {
if (!$test instanceof TestMethod) {
continue;
}
foreach ($test->metadata() as $metadata) {
| mfony\Bridge\PhpUnit\Metadata\AttributeReader;
/**
* @internal
*/
class RegisterClockMockSubscriber implements LoadedSubscriber
{
public function __construct(
private AttributeReader $reader,
) {
}
pub | {
"filepath": "src/Symfony/Bridge/PhpUnit/Extension/RegisterClockMockSubscriber.php",
"language": "php",
"file_size": 1437,
"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\PhpUnit\Legacy;
use PHPUnit\TextUI\Command as BaseCommand;
use PHPUnit\TextUI\Configuration\Configuration a... | >arguments['listeners'] = [];
$registeredLocally = false;
foreach ($this->arguments['listeners'] as $registeredListener) {
if ($registeredListener instanceof SymfonyTestsListener) {
$registeredListener->globalL | ation\Loader;
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;
/**
* @internal
*/
class CommandForV9 extends BaseCommand
{
protected function createRunner(): BaseRunner
{
$this->arguments['listeners'] ?? $this- | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/CommandForV9.php",
"language": "php",
"file_size": 2169,
"cut_index": 563,
"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\PhpUnit\Legacy;
/**
* @internal
*/
trait ConstraintTraitF... | d function additionalFailureDescription($other): string
{
return $this->doAdditionalFailureDescription($other);
}
protected function failureDescription($other): string
{
return $this->doFailureDescription($other);
}
| uate($other, $description, $returnResult);
}
public function count(): int
{
return $this->doCount();
}
public function toString(): string
{
return $this->doToString();
}
protecte | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV8.php",
"language": "php",
"file_size": 1098,
"cut_index": 515,
"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\PhpUnit\Legacy;
/**
* @internal, use Symfony\Bridge\PhpUnit\ExpectDeprecationTra... | sultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
$expectedDeprecations = file_get_contents($file);
if ($expectedDeprecations) {
$expectedDeprecations = array_merge(unserialize($expectedDeprecations), [$m | ations set by isolated tests need to be written to a file
// so that the test running process can take account of them.
if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
$this->getTestRe | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/ExpectDeprecationTraitBeforeV8_4.php",
"language": "php",
"file_size": 1511,
"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\PhpUnit\Legacy;
use PHPUnit\Framework\Constraint\LogicalNot;
use PHPUnit\Framework\Constraint\TraversableContains;
/**
* This trait is @internal.
*/
trait ... | $message
*
* @return void
*/
public static function assertNotContainsEquals($needle, $haystack, $message = '')
{
$constraint = new LogicalNot(new TraversableContains($needle, false, false));
static::assertThat($hayst | tack, $message = '')
{
$constraint = new TraversableContains($needle, false, false);
static::assertThat($haystack, $constraint, $message);
}
/**
* @param iterable $haystack
* @param string | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php",
"language": "php",
"file_size": 3797,
"cut_index": 614,
"middle_length": 229
} |
e PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Runner\BaseTestRunner;
use PHPUnit\Runner\PhptTestCase;
use PHPUnit\Util\Blacklist;
use PHPUnit\Util\ExcludeList;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Bridge\PhpUnit\DnsMock;
use Symfony\Bridge\PhpUnit\ExpectD... | $state = -1;
private $skippedFile = false;
private $wasSkipped = [];
private $isSkipped = [];
private $runsInSeparateProcess = false;
private $checkNumAssertions = false;
/**
* @param array $mockedNamespaces List of namespaces | */
class SymfonyTestsListenerTrait
{
public static $expectedDeprecations = [];
public static $previousErrorHandler;
private static $gatheredDeprecations = [];
private static $globallyEnabled = false;
private | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php",
"language": "php",
"file_size": 14932,
"cut_index": 921,
"middle_length": 229
} |
ork\TestSuite;
use PHPUnit\Metadata\Api\Groups;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor;
use Symfony\Component\ErrorHandler\DebugClassLoader;
class_exists(Groups::class);
/**
* @internal
*/
class Deprecation
{
public const PATH_TYPE_VENDOR = 'path_type_vendor';
publi... | private $originMethod;
private $triggeringFile;
private $triggeringClass;
/** @var string[] Absolute paths to vendor directories */
private static $vendors;
/**
* @var string[] Absolute paths to source or tests of the project, | pe_direct';
public const TYPE_INDIRECT = 'type_indirect';
public const TYPE_UNDETERMINED = 'type_undetermined';
private $trace = [];
private $message;
private $languageDeprecation;
private $originClass;
| {
"filepath": "src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php",
"language": "php",
"file_size": 14674,
"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\PhpUnit\DeprecationErrorHandler;
/**
* @internal
*/
final class De... | essage): void
{
$this->deprecationNotice($message)->addProceduralOccurrence();
$this->addNotice();
}
public function addNotice(): void
{
++$this->count;
}
private function deprecationNotice(string $message) | g $message, string $class, string $method): void
{
$this->deprecationNotice($message)->addObjectOccurrence($class, $method);
$this->addNotice();
}
public function addNoticeFromProceduralCode(string $m | {
"filepath": "src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationGroup.php",
"language": "php",
"file_size": 1327,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framewor... | 125);
}
public function testTime()
{
$this->assertSame(1234567890, time());
}
public function testSleep()
{
sleep(2);
$this->assertSame(1234567892, time());
}
public function testMicrotime()
{
| ass ClockMockTest extends TestCase
{
public static function setUpBeforeClass(): void
{
ClockMock::register(__CLASS__);
}
protected function setUp(): void
{
ClockMock::withClockMock(1234567890. | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php",
"language": "php",
"file_size": 1912,
"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\WebLink\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\GenericLinkProvider;
use Sy... | >withLink($link);
$this->assertContains($link, $provider->getLinks());
}
public function testCanAddLinksByConstructor()
{
$link = (new Link())
->withHref('http://www.google.com')
->withRel('next')
| ()
{
$link = (new Link())
->withHref('http://www.google.com')
->withRel('next')
->withAttribute('me', 'you')
;
$provider = (new GenericLinkProvider())
- | {
"filepath": "src/Symfony/Component/WebLink/Tests/GenericLinkProviderTest.php",
"language": "php",
"file_size": 2271,
"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\PhpUnit;
/**
* @author Roland Franssen <franssen.roland@gmail.com>
*/
class ClassExistsMock
{
private... | ums to be checked upon existence.
*
* @param array $enums Mocked enums names as keys (case-sensitive, without leading root namespace slash) and booleans as values
*/
public static function withMockedEnums(array $enums): void
{
| e-sensitive, without leading root namespace slash) and booleans as values
*/
public static function withMockedClasses(array $classes): void
{
self::$classes = $classes;
}
/**
* Configures the en | {
"filepath": "src/Symfony/Bridge/PhpUnit/ClassExistsMock.php",
"language": "php",
"file_size": 2936,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\PhpUnit;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class DnsMock
{
private static $hosts = [];
private static $dnsTypes = [
'A' => \DNS_A,
'MX' => \DNS_MX,
'NS' => \DNS_NS,
'SOA' => \DNS_SOA,
'PTR' => \DN... | turned by dns_get_record() as values
*/
public static function withMockedHosts(array $hosts): void
{
self::$hosts = $hosts;
}
public static function checkdnsrr($hostname, $type = 'MX'): bool
{
if (!self::$hosts) {
| => \DNS_HINFO,
'CAA' => '\\' !== \DIRECTORY_SEPARATOR ? \DNS_CAA : 0,
];
/**
* Configures the mock values for DNS queries.
*
* @param array $hosts Mocked hosts as keys, arrays of DNS records as re | {
"filepath": "src/Symfony/Bridge/PhpUnit/DnsMock.php",
"language": "php",
"file_size": 6074,
"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\PhpUnit\Extension;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Ev... | unction notify(Loaded $event): void
{
foreach ($event->testSuite()->tests() as $test) {
if (!$test instanceof TestMethod) {
continue;
}
foreach ($test->metadata() as $metadata) {
| ny\Bridge\PhpUnit\Metadata\AttributeReader;
/**
* @internal
*/
class RegisterDnsMockSubscriber implements LoadedSubscriber
{
public function __construct(
private AttributeReader $reader,
) {
}
public f | {
"filepath": "src/Symfony/Bridge/PhpUnit/Extension/RegisterDnsMockSubscriber.php",
"language": "php",
"file_size": 1426,
"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\PhpUnit\Legacy;
/**
* @internal
*/
trait ConstraintLogicTrai... | r): string
{
return '';
}
private function doCount(): int
{
return 1;
}
private function doFailureDescription($other): string
{
return $this->exporter()->export($other).' '.$this->toString();
}
| if ($returnResult) {
return $success;
}
if (!$success) {
$this->fail($other, $description);
}
return null;
}
private function doAdditionalFailureDescription($othe | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/ConstraintLogicTrait.php",
"language": "php",
"file_size": 1155,
"cut_index": 518,
"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\PhpUnit\Legacy;
/**
* @internal
*/
trait ConstraintTraitF... | ailureDescription($other): string
{
return $this->doAdditionalFailureDescription($other);
}
protected function failureDescription($other): string
{
return $this->doFailureDescription($other);
}
protected function m | ion, $returnResult);
}
public function count(): int
{
return $this->doCount();
}
public function toString(): string
{
return $this->doToString();
}
protected function additionalF | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/ConstraintTraitForV9.php",
"language": "php",
"file_size": 1076,
"cut_index": 515,
"middle_length": 229
} |
* @var string
*/
private $regex;
/**
* @var bool
*/
private $enabled = true;
/**
* @var bool[]
*/
private $verboseOutput;
/**
* @var string[]
*/
private $ignoreDeprecationPatterns = [];
/**
* @var bool
*/
private $generateBaseline ... | k trace
* @param bool[] $verboseOutput Keyed by groups
* @param string $ignoreFile The path to the ignore deprecation patterns file
* @param bool $generateBaseline Whether to generate or update the baseline file
|
private $logFile;
/**
* @param int[] $thresholds A hash associating groups to thresholds
* @param string $regex Will be matched against messages, to decide whether to display a stac | {
"filepath": "src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Configuration.php",
"language": "php",
"file_size": 12400,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\PhpUnit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClassExistsMock;
class ClassExistsMockTest extends TestCase
{
public static function setUpBeforeClass(): void
{
ClassExistsMock::register(__CLASS__);
}
protecte... | true,
]);
}
public function testClassExists()
{
$this->assertFalse(class_exists(ExistingClass::class));
$this->assertFalse(class_exists(ExistingClass::class, false));
$this->assertFalse(class_exists('\\'.Existi | ass => false,
'NonExistingInterface' => true,
ExistingTrait::class => false,
'NonExistingTrait' => true,
]);
ClassExistsMock::withMockedEnums([
'NonExistingEnum' => | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/ClassExistsMockTest.php",
"language": "php",
"file_size": 6979,
"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\WebLink\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Compo... | ony\Component\WebLink\Link;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class AddLinkHeaderListenerTest extends TestCase
{
public function testOnKernelResponse()
{
$request = new Request([], [], ['_links' => new GenericLinkProvide | ;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\WebLink\EventListener\AddLinkHeaderListener;
use Symfony\Component\WebLink\GenericLinkProvider;
use Symf | {
"filepath": "src/Symfony/Component/WebLink/Tests/EventListener/AddLinkHeaderListenerTest.php",
"language": "php",
"file_size": 1986,
"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\PhpUnit;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementati... | olver ?? static function (Test $test): ?string {
$class = $test::class;
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
return class_exists($sutFqcn) ? $ | ntation;
private $sutFqcnResolver;
private $warningOnSutNotFound;
public function __construct(?callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
{
$this->sutFqcnResolver = $sutFqcnRes | {
"filepath": "src/Symfony/Bridge/PhpUnit/CoverageListener.php",
"language": "php",
"file_size": 3584,
"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\PhpUnit\Legacy;
use PHPUnit\TextUI\Command as BaseCommand;
use PHPUnit\TextUI\Tes... | if ($registeredListener instanceof SymfonyTestsListener) {
$registeredListener->globalListenerDisabled();
$registeredLocally = true;
break;
}
}
if (isset($this->arguments['confi | eateRunner(): BaseRunner
{
$this->arguments['listeners'] ?? $this->arguments['listeners'] = [];
$registeredLocally = false;
foreach ($this->arguments['listeners'] as $registeredListener) {
| {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/CommandForV8.php",
"language": "php",
"file_size": 1760,
"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\PhpUnit\Legacy;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\Te... | t = new SymfonyTestsListenerTrait($mockedNamespaces);
}
public function globalListenerDisabled()
{
$this->trait->globalListenerDisabled();
}
public function startTestSuite(TestSuite $suite): void
{
$this->trait->st | *
* @internal
*/
class SymfonyTestsListenerForV7 implements TestListener
{
use TestListenerDefaultImplementation;
private $trait;
public function __construct(array $mockedNamespaces = [])
{
$this->trai | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerForV7.php",
"language": "php",
"file_size": 1407,
"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\PhpUnit\Tests;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
#[Require... | lode("\n", $output);
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+100.00%[^\n]+Lines:\s+100.00%/', $output);
$output = '';
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --co | ;
$php = $this->findCoverageDriver();
$output = '';
exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
$output = imp | {
"filepath": "src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php",
"language": "php",
"file_size": 2610,
"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\PhpUnit\Extension;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Ev... | ,
) {
}
public function notify(PreparationStarted $event): void
{
$test = $event->test();
if (!$test instanceof TestMethod) {
return;
}
foreach ($test->metadata() as $metadata) {
if | ckMock;
use Symfony\Bridge\PhpUnit\Metadata\AttributeReader;
/**
* @internal
*/
class EnableClockMockSubscriber implements PreparationStartedSubscriber
{
public function __construct(
private AttributeReader $reader | {
"filepath": "src/Symfony/Bridge/PhpUnit/Extension/EnableClockMockSubscriber.php",
"language": "php",
"file_size": 1357,
"cut_index": 524,
"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\Bridge\PhpUnit\DeprecationErrorHandler;
/**
* @internal
*/
final class DeprecationNotice
{
private $count = 0;
/**
* ... |
}
++$this->countsByCaller["$class::$method"];
++$this->count;
}
public function addProceduralOccurrence(): void
{
++$this->count;
}
public function getCountsByCaller(): array
{
return $this | $this->countsByCaller["$class::$method"] = 0; | {
"filepath": "src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/DeprecationNotice.php",
"language": "php",
"file_size": 991,
"cut_index": 582,
"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\PhpUnit\Legacy;
/**
* @internal use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead
*/
trait Expect... | to a file
// so that the test running process can take account of them.
if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
$this->getTestResultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
$ | arg(0))) {
throw new \InvalidArgumentException(\sprintf('The "%s()" method requires the string $message argument.', __FUNCTION__));
}
// Expected deprecations set by isolated tests need to be written | {
"filepath": "src/Symfony/Bridge/PhpUnit/Legacy/ExpectDeprecationTraitForV8_4.php",
"language": "php",
"file_size": 2392,
"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\Monolog\Handler;
use Monolog\Handler\ChromePHPHandler as BaseChromePhpHandler;
us... | e(ResponseEvent $event): void
{
if (!$event->isMainRequest()) {
return;
}
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent', ''))) {
self::$sendHeaders = false;
| lass ChromePhpHandler extends BaseChromePhpHandler
{
private array $headers = [];
private Response $response;
/**
* Adds the headers to the response once it's created.
*/
public function onKernelRespons | {
"filepath": "src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php",
"language": "php",
"file_size": 1783,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Monolog\Handler;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Level;
use Monolog\LogRecord;
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
use Symfony\Componen... |
/**
* Writes logs to the console output depending on its verbosity setting.
*
* It is disabled by default and gets activated as soon as a command is executed.
* Instead of listening to the console events, the output can also be set manually.
*
* Th |
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\VarDumper\Dumper\CliDumper; | {
"filepath": "src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php",
"language": "php",
"file_size": 7084,
"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\Attribute;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
use Symfony\Component\HttpKernel\Attribute\ValueResolver;
/**
* Indica... | ntity using the {@see https://symfony.com/doc/current/components/expression_language.html ExpressionLanguage} syntax.
* Any request attribute are available as a variable, and your entity repository in t | $class The entity class
* @param string|null $objectManager Specify the object manager used to retrieve the entity
* @param string|null $expr An expression to fetch the e | {
"filepath": "src/Symfony/Bridge/Doctrine/Attribute/MapEntity.php",
"language": "php",
"file_size": 4393,
"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\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
... | {
if ($this->hasNativeGuidType($platform)) {
return $platform->getGuidTypeDeclarationSQL($column);
}
return $platform->getBinaryTypeDeclarationSQL([
'length' => 16,
'fixed' => true,
]) | actUidType extends Type
{
/**
* @return class-string<AbstractUid>
*/
abstract protected function getUidClass(): string;
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
| {
"filepath": "src/Symfony/Bridge/Doctrine/Types/AbstractUidType.php",
"language": "php",
"file_size": 2999,
"cut_index": 563,
"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\Types;
use Doctrine\DBAL\Platforms\AbstractPlatf... | === $value || $value instanceof DatePoint) {
return $value;
}
$value = parent::convertToPHPValue($value, $platform);
return DatePoint::createFromInterface($value);
}
public function getName(): string
{
| /**
* @param T $value
*
* @return (T is null ? null : DatePoint)
*
* @template T
*/
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?DatePoint
{
if (null | {
"filepath": "src/Symfony/Bridge/Doctrine/Types/DatePointType.php",
"language": "php",
"file_size": 1031,
"cut_index": 513,
"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\Bridge\Doctrine\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\DateImmutableType;
use Symfony\Component... | m $platform): ?DatePoint
{
if (null === $value || $value instanceof DatePoint) {
return $value;
}
$value = parent::convertToPHPValue($value, $platform);
return DatePoint::createFromInterface($value);
}
| tion convertToPHPValue(mixed $value, AbstractPlatfor | {
"filepath": "src/Symfony/Bridge/Doctrine/Types/DayPointType.php",
"language": "php",
"file_size": 970,
"cut_index": 582,
"middle_length": 52
} |
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\Bridge\Doctrine\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\TimeImmutableType;
use Symfony\Component... | orm $platform): ?DatePoint
{
if (null === $value || $value instanceof DatePoint) {
return $value;
}
$value = parent::convertToPHPValue($value, $platform);
return DatePoint::createFromInterface($value);
| nction convertToPHPValue(mixed $value, AbstractPlatf | {
"filepath": "src/Symfony/Bridge/Doctrine/Types/TimePointType.php",
"language": "php",
"file_size": 972,
"cut_index": 582,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\DataCollector;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder;
use Symfony\Component\HttpFoundation\Request;
use Symfony... | t(
private ManagerRegistry $registry,
private DebugDataHolder $debugDataHolder,
) {
$this->connections = $registry->getConnectionNames();
$this->managers = $registry->getManagerNames();
}
public function collect | **
* DoctrineDataCollector.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DoctrineDataCollector extends DataCollector
{
private array $connections;
private array $managers;
public function __construc | {
"filepath": "src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php",
"language": "php",
"file_size": 6591,
"cut_index": 716,
"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\Bridge\Doctrine\DataCollector;
final class ObjectParameter
{
private bool $stringable;
private string $class;
public fun... | getObject(): object
{
return $this->object;
}
public function getError(): ?\Throwable
{
return $this->error;
}
public function isStringable(): bool
{
return $this->stringable;
}
public functio | ->class = $object::class;
}
public function | {
"filepath": "src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php",
"language": "php",
"file_size": 954,
"cut_index": 582,
"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\Doctrine\Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\Form\T... | try,
) {
}
protected function loadTypes(): array
{
return [
new EntityType($this->registry),
];
}
protected function loadTypeGuesser(): ?FormTypeGuesserInterface
{
return new DoctrineOrmType | _construct(
protected ManagerRegistry $regis | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php",
"language": "php",
"file_size": 889,
"cut_index": 547,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\Form;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\FieldMapping;
use Doctrine\ORM\Mapping\JoinColumnMapping;
use Doctrine\ORM\Mapping\MappingException as Le... | n\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\Textare | ype;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\DateIntervalType;
use Symfony\Component\Form\Extensio | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php",
"language": "php",
"file_size": 8373,
"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\Form\ChoiceList;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\ChoiceList\Loader\AbstractChoiceLoader;
use Symfony\Component\For... | s the object loading for one of the Doctrine
* mapper implementations.
*
* @param string $class The class name of the loaded objects
*/
public function __construct(
private readonly ObjectManager $manager,
string $cl | ader
{
/** @var class-string */
private readonly string $class;
/**
* Creates a new choice loader.
*
* Optionally, an implementation of {@link EntityLoaderInterface} can be
* passed which optimize | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php",
"language": "php",
"file_size": 4200,
"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\Form\ChoiceList;
use Doctrine\Persistence\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\Exception\Runtime... | lassMetadata,
) {
$ids = $classMetadata->getIdentifierFieldNames();
$idType = $classMetadata->getTypeOfField(current($ids));
$singleId = 1 === \count($ids);
$this->idField = current($ids);
// single field assoc | readonly bool $intId;
private readonly string $idField;
private readonly ?self $associationIdReader;
public function __construct(
private readonly ObjectManager $om,
private readonly ClassMetadata $c | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php",
"language": "php",
"file_size": 3096,
"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\Form\ChoiceList;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Qu... | QueryBuilder $queryBuilder,
) {
}
public function getEntities(): array
{
return $this->queryBuilder->getQuery()->execute();
}
public function getEntitiesByIds(string $identifier, array $values): array
{
if (nu |
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ORMQueryBuilderLoader implements EntityLoaderInterface
{
public function __construct(
private readonly | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php",
"language": "php",
"file_size": 4082,
"cut_index": 614,
"middle_length": 229
} |
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer;
use Symfony\Bridge\Doctrine\Form\EventListener\MergeD... | OptionsResolver\OptionsResolver;
use Symfony\Component\Uid\Uuid;
use Symfony\Contracts\Service\ResetInterface;
abstract class DoctrineType extends AbstractType implements ResetInterface
{
/**
* @var IdReader[]
*/
private array $idReaders | Symfony\Component\Form\Exception\RuntimeException;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\ | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php",
"language": "php",
"file_size": 10978,
"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\Doctrine\Form\Type;
use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\Form\... | ache choice lists
// for equal query builders
$queryBuilderNormalizer = static function (Options $options, $queryBuilder) {
if (\is_callable($queryBuilder)) {
$queryBuilder = $queryBuilder($options['em']->getRepo | lver;
class EntityType extends DoctrineType
{
public function configureOptions(OptionsResolver $resolver): void
{
parent::configureOptions($resolver);
// Invoke the query builder closure so that we can c | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php",
"language": "php",
"file_size": 3148,
"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\Doctrine\Form\EventListener;
use Doctrine\Common\Collections\Collect... | ineCollectionListener implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
// Higher priority than core MergeCollectionListener so that this one
// is called before
return [
| ctrine\Common\Collections\Collection instance.
*
* This works with ORM, MongoDB and CouchDB instances of the collection interface.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @see Collection
*/
class MergeDoctr | {
"filepath": "src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php",
"language": "php",
"file_size": 1488,
"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\Form\DataTransformer;
use Doctrine\Common\Collections\ArrayCollection;
u... | public function transform(mixed $collection): mixed
{
if (null === $collection) {
return [];
}
// For cases when the collection getter returns $collection->toArray()
// in order to prevent modifications of t | rmationFailedException;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @implements DataTransformerInterface<Collection|array, array>
*/
class CollectionToArrayTransformer implements DataTransformerInterface
{
| {
"filepath": "src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php",
"language": "php",
"file_size": 1617,
"cut_index": 537,
"middle_length": 229
} |
ctrine\ORM\Mapping\AssociationMapping;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\EmbeddedClassMapping;
use Doctrine\ORM\Mapping\FieldMapping;
use Doctrine\ORM\Mapping\JoinColumnMapping;
use Doctrine\ORM\Mapping\MappingException as OrmMappingException;
use Doctrine\Persistence\Mapping\MappingExcep... | ractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
) {
}
public function getProp | ractorInterface;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeIdentifier;
/**
* Extracts data using Doctrine ORM and ODM metadata.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class DoctrineExt | {
"filepath": "src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php",
"language": "php",
"file_size": 10528,
"cut_index": 921,
"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\Middleware\IdleConnection;
use Doctrine\DBAL\Drive... | ttl,
private readonly string $connectionName,
) {
parent::__construct($driver);
}
public function connect(array $params): ConnectionInterface
{
$timestamp = time();
$connection = parent::connect($params);
| ware
{
/**
* @param \ArrayObject<string, int> $connectionExpiries
*/
public function __construct(
DriverInterface $driver,
private \ArrayObject $connectionExpiries,
private readonly int $ | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/IdleConnection/Driver.php",
"language": "php",
"file_size": 1119,
"cut_index": 515,
"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\Middleware\IdleConnection;
use Symfony\Component\DependencyInjection\Con... | eadonly \ArrayObject $connectionExpiries,
private ContainerInterface $container,
) {
}
public function onKernelRequest(RequestEvent $event): void
{
if (HttpKernelInterface::MAIN_REQUEST !== $event->getRequestType()) {
| Symfony\Component\HttpKernel\KernelEvents;
final class Listener implements EventSubscriberInterface
{
/**
* @param \ArrayObject<string, int> $connectionExpiries
*/
public function __construct(
private r | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/IdleConnection/Listener.php",
"language": "php",
"file_size": 1849,
"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\Middleware\Debug;
use Doctrine\DBAL\Driver\Connection as ConnectionInterface;
use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware;
use D... | ly ?Stopwatch $stopwatch,
private readonly string $connectionName,
) {
parent::__construct($connection);
}
public function prepare(string $sql): Statement
{
return new Statement(
parent::prepare($sql),
| nternal
*/
final class Connection extends AbstractConnectionMiddleware
{
public function __construct(
ConnectionInterface $connection,
private readonly DebugDataHolder $debugDataHolder,
private readon | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/Connection.php",
"language": "php",
"file_size": 3293,
"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\Doctrine\Middleware\Debug;
/**
* @author Laurent VOULLEMIER <... | at this point
];
}
public function getData(): array
{
foreach ($this->data as $connectionName => $dataForConn) {
foreach ($dataForConn as $idx => $data) {
if (\is_callable($data['executionMS'])) {
| nectionName][] = [
'sql' => $query->getSql(),
'params' => $query->getParams(),
'types' => $query->getTypes(),
'executionMS' => $query->getDuration(...), // stop() may not be called | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/DebugDataHolder.php",
"language": "php",
"file_size": 1250,
"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\Bridge\Doctrine\Middleware\Debug;
use Doctrine\DBAL\Driver as DriverI... | $debugDataHolder,
private readonly ?Stopwatch $stopwatch,
private readonly string $connectionName,
) {
parent::__construct($driver);
}
public function connect(array $params): ConnectionInterface
{
$connecti | aurent VOULLEMIER <laurent.voullemier@gmail.com>
*
* @internal
*/
final class Driver extends AbstractDriverMiddleware
{
public function __construct(
DriverInterface $driver,
private readonly DebugDataHolder | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/Driver.php",
"language": "php",
"file_size": 1210,
"cut_index": 518,
"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\Middleware\Debug;
use Doctrine\DBAL\Driver as D... | ch,
private readonly string $connectionName = 'default',
) {
}
public function wrap(DriverInterface $driver): DriverInterface
{
return new Driver($driver, $this->debugDataHolder, $this->stopwatch, $this->connectionName);
| R <laurent.voullemier@gmail.com>
*/
final class Middleware implements MiddlewareInterface
{
public function __construct(
private readonly DebugDataHolder $debugDataHolder,
private readonly ?Stopwatch $stopwat | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/Middleware.php",
"language": "php",
"file_size": 1003,
"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\Bridge\Doctrine\Middleware\Debug;
use Doctrine\DBAL\ParameterType;
/**
* @author Laurent VOULLEMIER <laurent.vou... | on stop(): void
{
if (null !== $this->start) {
$this->duration = microtime(true) - $this->start;
}
}
public function setParam(string|int $param, mixed &$variable, ParameterType|int $type): void
{
// Nume |
private ?float $duration = null;
public function __construct(
private readonly string $sql,
) {
}
public function start(): void
{
$this->start = microtime(true);
}
public functi | {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php",
"language": "php",
"file_size": 2484,
"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\Middleware\Debug;
use Doctrine\DBAL\Driver\Middleware\AbstractStatementM... | public function __construct(
StatementInterface $statement,
private readonly DebugDataHolder $debugDataHolder,
private readonly string $connectionName,
string $sql,
private readonly ?Stopwatch $stopwatch = null,
| tch;
/**
* @author Laurent VOULLEMIER <laurent.voullemier@gmail.com>
* @author Alexander M. Turek <me@derrabus.de>
*
* @internal
*/
final class Statement extends AbstractStatementMiddleware
{
private Query $query;
| {
"filepath": "src/Symfony/Bridge/Doctrine/Middleware/Debug/Statement.php",
"language": "php",
"file_size": 1784,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Bridge\Doctrine\SchemaListener;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
use Doctrine\DBAL\Exception\DatabaseObjectExistsException;
use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException;
use Doctrine\DBAL\Schema\N... | oid;
/**
* @param callable(): Schema $configurator returns the (possibly new) schema with the table added
*
* @param-immediately-invoked-callable $configurator
*/
protected function filterSchemaChanges(Schema $schema, Connectio | e\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
abstract class AbstractSchemaListener
{
abstract public function postGenerateSchema(GenerateSchemaEventArgs $event): v | {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/AbstractSchemaListener.php",
"language": "php",
"file_size": 6741,
"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\SchemaListener;
use Doctrine\ORM\Tools\Event\GenerateSchema... | ) {
}
public function postGenerateSchema(GenerateSchemaEventArgs $event): void
{
$connection = $event->getEntityManager()->getConnection();
$schema = $event->getSchema();
foreach ($this->dbalAdapters as $dbalAdapter) | balCacheAdapterSchemaListener extends AbstractSchemaListener
{
/**
* @param iterable<mixed, DoctrineDbalAdapter> $dbalAdapters
*/
public function __construct(
private readonly iterable $dbalAdapters,
| {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/DoctrineDbalCacheAdapterSchemaListener.php",
"language": "php",
"file_size": 1378,
"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\SchemaListener;
use Doctrine\ORM\Tools\Event\GenerateSchema... | event): void
{
$connection = $event->getEntityManager()->getConnection();
$schema = $event->getSchema();
foreach ($this->stores as $store) {
if (!$store instanceof DoctrineDbalStore) {
continue;
| *
* @param iterable<mixed, PersistingStoreInterface> $stores
*/
public function __construct(
private readonly iterable $stores,
) {
}
public function postGenerateSchema(GenerateSchemaEventArgs $ | {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/LockStoreSchemaListener.php",
"language": "php",
"file_size": 1368,
"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\SchemaListener;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
us... | rivate readonly iterable $transports,
) {
}
public function postGenerateSchema(GenerateSchemaEventArgs $event): void
{
$connection = $event->getEntityManager()->getConnection();
$schema = $event->getSchema();
forea | to the Doctrine Schema.
*/
class MessengerTransportDoctrineSchemaListener extends AbstractSchemaListener
{
/**
* @param iterable<mixed, TransportInterface> $transports
*/
public function __construct(
p | {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/MessengerTransportDoctrineSchemaListener.php",
"language": "php",
"file_size": 1527,
"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\Doctrine\SchemaListener;
use Doctrine\ORM\Tools\Event\GenerateSchema... | }
public function postGenerateSchema(GenerateSchemaEventArgs $event): void
{
if (!isset($this->sessionHandler)) {
return;
}
$connection = $event->getEntityManager()->getConnection();
$schema = $event | andler $sessionHandler;
public function __construct(\SessionHandlerInterface $sessionHandler)
{
if ($sessionHandler instanceof PdoSessionHandler) {
$this->sessionHandler = $sessionHandler;
}
| {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/PdoSessionHandlerSchemaListener.php",
"language": "php",
"file_size": 1413,
"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\SchemaListener;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
us... | am iterable<mixed, RememberMeHandlerInterface> $rememberMeHandlers
*/
public function __construct(
private readonly iterable $rememberMeHandlers,
) {
}
public function postGenerateSchema(GenerateSchemaEventArgs $event): void
| RememberMeHandlerInterface;
/**
* Automatically adds the rememberme table needed for the {@see DoctrineTokenProvider}.
*/
class RememberMeTokenProviderDoctrineSchemaListener extends AbstractSchemaListener
{
/**
* @par | {
"filepath": "src/Symfony/Bridge/Doctrine/SchemaListener/RememberMeTokenProviderDoctrineSchemaListener.php",
"language": "php",
"file_size": 1810,
"cut_index": 537,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.