Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private function sendToElasticsearch(array $records): void
],
]);

$this->responses->attach($response);
$this->responses[$response] = null;

$this->wait(false);
}
Expand Down Expand Up @@ -178,10 +178,10 @@ private function wait(bool $blocking): void
continue;
}
if ($chunk->isLast()) {
$this->responses->detach($response);
unset($this->responses[$response]);
}
} catch (ExceptionInterface $e) {
$this->responses->detach($response);
unset($this->responses[$response]);
error_log(\sprintf("Could not push logs to Elasticsearch:\n%s", (string) $e));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function setUp(): void
];

$transitionsMetadata = new \SplObjectStorage();
$transitionsMetadata->attach($this->t1, ['title' => 't1 title']);
$transitionsMetadata[$this->t1] = ['title' => 't1 title'];
$metadataStore = new InMemoryMetadataStore(
['title' => 'workflow title'],
['orderer' => ['title' => 'ordered title']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ private function addServiceConfigurator(Definition $definition, string $variable

if (\is_array($callable)) {
if ($callable[0] instanceof Reference
|| ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))
|| ($callable[0] instanceof Definition && $this->definitionVariables->offsetExists($callable[0]))
) {
return \sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName);
}
Expand Down Expand Up @@ -1205,15 +1205,15 @@ private function addNewInstance(Definition $definition, string $return = '', ?st

if (['...'] === $arguments && ('Closure' !== ($class = $definition->getClass() ?: 'Closure') || $definition->isLazy() && (
$callable[0] instanceof Reference
|| ($callable[0] instanceof Definition && !$this->definitionVariables->contains($callable[0]))
|| ($callable[0] instanceof Definition && !$this->definitionVariables->offsetExists($callable[0]))
))) {
$initializer = 'fn () => '.$this->dumpValue($callable[0]);

return $return.LazyClosure::getCode($initializer, $callable, $class, $this->container, $id).$tail;
}

if ($callable[0] instanceof Reference
|| ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))
|| ($callable[0] instanceof Definition && $this->definitionVariables->offsetExists($callable[0]))
) {
return $return.\sprintf('%s->%s(%s)', $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : '').$tail;
}
Expand Down Expand Up @@ -1920,7 +1920,7 @@ private function dumpValue(mixed $value, bool $interpolate = true): string
if ($value->hasErrors() && $e = $value->getErrors()) {
return \sprintf('throw new RuntimeException(%s)', $this->export(reset($e)));
}
if ($this->definitionVariables?->contains($value)) {
if ($this->definitionVariables?->offsetExists($value)) {
return $this->dumpValue($this->definitionVariables[$value], $interpolate);
}
if ($value->getMethodCalls()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
$this->wrappedListeners[$eventName][] = $wrappedListener;
$this->dispatcher->removeListener($eventName, $listener);
$this->dispatcher->addListener($eventName, $wrappedListener, $priority);
$this->callStack->attach($wrappedListener, [$eventName, $this->currentRequestHash]);
$this->callStack[$wrappedListener] = [$eventName, $this->currentRequestHash];

Check failure on line 282 in src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:282:30: InvalidArgument: Argument 1 of SplObjectStorage::offsetGet expects Symfony\Component\EventDispatcher\Debug\WrappedListener, but impure-callable(object, string, Symfony\Component\EventDispatcher\EventDispatcherInterface):void provided (see https://psalm.dev/004)

Check failure on line 282 in src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

View workflow job for this annotation

GitHub Actions / Psalm

InvalidArgument

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:282:30: InvalidArgument: Argument 1 of SplObjectStorage::offsetGet expects Symfony\Component\EventDispatcher\Debug\WrappedListener, but impure-callable(object, string, Symfony\Component\EventDispatcher\EventDispatcherInterface):void provided (see https://psalm.dev/004)
}
}

Expand All @@ -303,7 +303,7 @@
if ($listener->wasCalled()) {
$this->logger?->debug('Notified event "{event}" to listener "{listener}".', $context);
} else {
$this->callStack->detach($listener);
unset($this->callStack[$listener]);
}

if (null !== $this->logger && $skipped) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
$this->data['redirect'] = true;
$this->data['url'] = $response->getTargetUrl();

if ($this->controllers->contains($request)) {
if ($this->controllers->offsetExists($request)) {
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function getNextTransport(): ?TransportInterface
}

if ((microtime(true) - $this->deadTransports[$transport]) > $this->retryPeriod) {
$this->deadTransports->detach($transport);
unset($this->deadTransports[$transport]);

break;
}
Expand All @@ -103,7 +103,7 @@ protected function getNextTransport(): ?TransportInterface

protected function isTransportDead(TransportInterface $transport): bool
{
return $this->deadTransports->contains($transport);
return $this->deadTransports->offsetExists($transport);
}

protected function getInitialCursor(): int
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Messenger/Tests/WorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ public function dispatch(object $message, array $stamps = []): Envelope
$unacks = $unacksProperty->getValue($worker);
$dummyHandler = new DummyBatchHandler();
$envelopeWithNoAutoAck = $envelope->with(new NoAutoAckStamp(new HandlerDescriptor($dummyHandler)));
$unacks->attach($dummyHandler, [$envelopeWithNoAutoAck, 'transport']);
$unacks[$dummyHandler] = [$envelopeWithNoAutoAck, 'transport'];

$worker->run();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function getNextTransport(MessageInterface $message): ?TransportInterf
}

if ((microtime(true) - $this->deadTransports[$transport]) > $this->retryPeriod) {
$this->deadTransports->detach($transport);
unset($this->deadTransports[$transport]);

break;
}
Expand All @@ -120,7 +120,7 @@ protected function getNextTransport(MessageInterface $message): ?TransportInterf

protected function isTransportDead(TransportInterface $transport): bool
{
return $this->deadTransports->contains($transport);
return $this->deadTransports->offsetExists($transport);
}

protected function getInitialCursor(): int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static function provideCastSplDoublyLinkedList()
public function testCastObjectStorageIsntModified()
{
$var = new \SplObjectStorage();
$var->attach(new \stdClass());
$var[new \stdClass()] = null;
$var->rewind();
$current = $var->current();

Expand All @@ -159,7 +159,7 @@ public function testCastObjectStorageIsntModified()
public function testCastObjectStorageDumpsInfo()
{
$var = new \SplObjectStorage();
$var->attach(new \stdClass(), new \DateTimeImmutable());
$var[new \stdClass()] = new \DateTimeImmutable();

$this->assertDumpMatchesFormat('%ADateTimeImmutable%A', $var);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/VarExporter/Internal/Hydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function getHydrator($class)
if ("\0" === $name) {
foreach ($values as $i => $v) {
for ($j = 0; $j < \count($v); ++$j) {
$objects[$i]->attach($v[$j], $v[++$j]);
$objects[$i][$v[$j]] = $v[++$j];
}
}
continue;
Expand Down Expand Up @@ -194,7 +194,7 @@ public static function getSimpleHydrator($class)
continue;
}
for ($i = 0; $i < \count($value); ++$i) {
$object->attach($value[$i], $value[++$i]);
$object[$value[$i]] = $value[++$i];
}
}
};
Expand Down
Loading