Skip to content

Commit b5e9d8b

Browse files
Merge branch '7.3' into 7.4
* 7.3: remove deprecated nullable option from primary key columns specific fix to avoid 'outag' when inflecting 'outages' [DependencyInjection] Don’t autowire excluded services Add bool return type to CustomCredentials callable parameter [Process] Enhance hasSystemCallBeenInterrupted function for non-english locale [FrameworkBundle] Make `cache:warmup` warm up read-only caches
2 parents 034386e + b7fe21d commit b5e9d8b

File tree

9 files changed

+41
-17
lines changed

9 files changed

+41
-17
lines changed

src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class CompositeObjectNoToStringIdEntity
2222
public function __construct(
2323
#[ORM\Id]
2424
#[ORM\ManyToOne(cascade: ['persist'])]
25-
#[ORM\JoinColumn(name: 'object_one_id', nullable: false)]
25+
#[ORM\JoinColumn(name: 'object_one_id')]
2626
protected SingleIntIdNoToStringEntity $objectOne,
2727

2828
#[ORM\Id]
2929
#[ORM\ManyToOne(cascade: ['persist'])]
30-
#[ORM\JoinColumn(name: 'object_two_id', nullable: false)]
30+
#[ORM\JoinColumn(name: 'object_two_id')]
3131
protected SingleIntIdNoToStringEntity $objectTwo,
3232
) {
3333
}

src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SingleAssociationToIntIdEntity
2222
{
2323
public function __construct(
2424
#[Id, OneToOne(cascade: ['ALL'])]
25-
#[JoinColumn(nullable: false)]
25+
#[JoinColumn()]
2626
protected SingleIntIdNoToStringEntity $entity,
2727

2828
#[Column(nullable: true)]

src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969
$kernel->warmUp($cacheDir);
7070
}
7171

72-
$preload = $this->cacheWarmer->warmUp($cacheDir);
73-
7472
$buildDir = $kernel->getContainer()->getParameter('kernel.build_dir');
73+
74+
$preload = $this->cacheWarmer->warmUp($cacheDir, $buildDir);
75+
7576
if ($preload && $cacheDir === $buildDir && file_exists($preloadFile = $buildDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
7677
Preloader::append($preloadFile, $preload);
7778
}

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,11 @@ private function getAutowiredReference(TypedReference $reference, bool $filterTy
459459
$name = $target = (array_filter($reference->getAttributes(), static fn ($a) => $a instanceof Target)[0] ?? null)?->name;
460460

461461
if (null !== $name ??= $reference->getName()) {
462-
if (null !== ($alias = $this->getCombinedAlias($type, $name, $target)) && !$this->container->findDefinition($alias)->isAbstract()) {
462+
if (null !== ($alias = $this->getCombinedAlias($type, $name, $target)) && $this->canDefinitionBeAutowired($alias)) {
463463
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
464464
}
465465

466-
if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) {
466+
if ($this->container->has($name) && $this->canDefinitionBeAutowired($name)) {
467467
foreach ($this->container->getAliases() as $id => $alias) {
468468
if ($name === (string) $alias && str_starts_with($id, $type.' $')) {
469469
return new TypedReference($name, $type, $reference->getInvalidBehavior());
@@ -476,13 +476,20 @@ private function getAutowiredReference(TypedReference $reference, bool $filterTy
476476
}
477477
}
478478

479-
if (null !== ($alias = $this->getCombinedAlias($type)) && !$this->container->findDefinition($alias)->isAbstract()) {
479+
if (null !== ($alias = $this->getCombinedAlias($type)) && $this->canDefinitionBeAutowired($alias)) {
480480
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
481481
}
482482

483483
return null;
484484
}
485485

486+
private function canDefinitionBeAutowired(string $id): bool
487+
{
488+
$definition = $this->container->findDefinition($id);
489+
490+
return !$definition->isAbstract() && !$definition->hasTag('container.excluded');
491+
}
492+
486493
/**
487494
* Populates the list of available types.
488495
*/
@@ -659,7 +666,7 @@ private function getAliasesSuggestionForType(ContainerBuilder $container, string
659666
{
660667
$aliases = [];
661668
foreach (class_parents($type) + class_implements($type) as $parent) {
662-
if ($container->has($parent) && !$container->findDefinition($parent)->isAbstract()) {
669+
if ($container->has($parent) && $this->canDefinitionBeAutowired($parent)) {
663670
$aliases[] = $parent;
664671
}
665672
}
@@ -704,7 +711,7 @@ private function getCombinedAlias(string $type, ?string $name = null, ?string $t
704711
$suffix = $name ? ' $'.($target ?? $name) : '';
705712
$parsedName = $target ?? ($name ? (new Target($name))->getParsedName() : null);
706713

707-
if ($this->container->has($alias = $prefix.$type.$suffix) && !$this->container->findDefinition($alias)->isAbstract()) {
714+
if ($this->container->has($alias = $prefix.$type.$suffix) && $this->canDefinitionBeAutowired($alias)) {
708715
return $alias;
709716
}
710717

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ public function testTypeSymbolExcluded()
13501350
{
13511351
$container = new ContainerBuilder();
13521352

1353-
$container->register(Foo::class)->setAbstract(true)->addTag('container.excluded', ['source' => 'for tests']);
1353+
$container->register(Foo::class)->addTag('container.excluded', ['source' => 'for tests']);
13541354
$aDefinition = $container->register('a', NotGuessableArgument::class);
13551355
$aDefinition->setAutowired(true);
13561356

@@ -1367,7 +1367,7 @@ public function testTypeNamespaceExcluded()
13671367
{
13681368
$container = new ContainerBuilder();
13691369

1370-
$container->register(__NAMESPACE__)->setAbstract(true)->addTag('container.excluded');
1370+
$container->register(__NAMESPACE__)->addTag('container.excluded');
13711371
$aDefinition = $container->register('a', NotGuessableArgument::class);
13721372
$aDefinition->setAutowired(true);
13731373

src/Symfony/Component/Process/Pipes/AbstractPipes.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,26 @@ public function close(): void
5252

5353
/**
5454
* Returns true if a system call has been interrupted.
55+
*
56+
* stream_select() returns false when the `select` system call is interrupted by an incoming signal.
5557
*/
5658
protected function hasSystemCallBeenInterrupted(): bool
5759
{
5860
$lastError = $this->lastError;
5961
$this->lastError = null;
6062

61-
// stream_select returns false when the `select` system call is interrupted by an incoming signal
62-
return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
63+
if (null === $lastError) {
64+
return false;
65+
}
66+
67+
if (false !== stripos($lastError, 'interrupted system call')) {
68+
return true;
69+
}
70+
71+
// on applications with a different locale than english, the message above is not found because
72+
// it's translated. So we also check for the SOCKET_EINTR constant which is defined under
73+
// Windows and UNIX-like platforms (if available on the platform).
74+
return \defined('SOCKET_EINTR') && str_starts_with($lastError, 'stream_select(): Unable to select ['.\SOCKET_EINTR.']');
6375
}
6476

6577
/**

src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class CustomCredentials implements CredentialsInterface
2727
private bool $resolved = false;
2828

2929
/**
30-
* @param callable(mixed, UserInterface) $customCredentialsChecker If the callable does not return `true`, a
31-
* BadCredentialsException is thrown. You may
32-
* also throw a more specific exception.
30+
* @param callable(mixed, UserInterface): bool $customCredentialsChecker If the callable does not return `true`, a
31+
* BadCredentialsException is thrown. You may
32+
* also throw a more specific exception.
3333
*/
3434
public function __construct(
3535
callable $customCredentialsChecker,

src/Symfony/Component/String/Inflector/EnglishInflector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ final class EnglishInflector implements InflectorInterface
166166
// edges (edge)
167167
['segd', 4, true, true, 'dge'],
168168

169+
// outages (outage) - specific fix to avoid 'outag'
170+
['segatuo', 7, true, true, 'outage'],
171+
169172
// roses (rose), garages (garage), cassettes (cassette),
170173
// waltzes (waltz), heroes (hero), bushes (bush), arches (arch),
171174
// shoes (shoe)

src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public static function singularizeProvider()
125125
['news', 'news'],
126126
['oases', ['oas', 'oase', 'oasis']],
127127
['objectives', 'objective'],
128+
['outages', 'outage'],
128129
['oxen', 'ox'],
129130
['parties', 'party'],
130131
['people', 'person'],

0 commit comments

Comments
 (0)