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

Skip to content

Commit b2683d6

Browse files
committed
Merge branch '7.3' into 7.4
* 7.3: do not use PHPUnit mock objects without configured expectations chore: PHP CS Fixer and protected_to_private Cleanup psalm config [FIX] Comments of horizontal/vertical were mixed up bug #62763 [Console] Escape the description passed to the lazy command so the container can be build without wanting to replace the %not-a-param% to parameters [BrowserKit] Allow Cookie expiration to be an int do not use PHPUnit mock objects without configured expectations [DependencyInjection] Fix `#[AutowireCallable]` sometimes incorrectly inlined do not use PHPUnit mock objects without configured expectations [Serializer] Fix php 8.5 warning unexpected NAN value was coerced to string add unit test job for PHP 8.6 [Messenger][Doctrine] Remove batched message delete for MySQL and add a covering index for a select query
2 parents 6d9f0fb + 71e59dd commit b2683d6

3 files changed

Lines changed: 35 additions & 7 deletions

File tree

DependencyInjection/AddConsoleCommandPass.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ public function process(ContainerBuilder $container): void
143143
}
144144

145145
if ($description) {
146-
$definition->addMethodCall('setDescription', [str_replace('%', '%%', $description)]);
146+
$escapedDescription = str_replace('%', '%%', $description);
147+
$definition->addMethodCall('setDescription', [$escapedDescription]);
147148

148149
$container->register('.'.$id.'.lazy', LazyCommand::class)
149-
->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
150+
->setArguments([$commandName, $aliases, $escapedDescription, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
150151

151152
$lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy');
152153
}

Helper/TableStyle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ public function getPaddingChar(): string
7878
*
7979
* <code>
8080
* ╔═══════════════╤══════════════════════════╤══════════════════╗
81-
* 1 ISBN 2 Title │ Author ║
82-
* ╠══════════════╪══════════════════════════╪══════════════════╣
81+
* ISBN Title │ Author ║
82+
* ╠═══════1═══════╪══════════════════════════╪══════════════════╣
8383
* ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
8484
* ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
85+
* ╟───────2───────┼──────────────────────────┼──────────────────╢
8586
* ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
8687
* ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
8788
* ╚═══════════════╧══════════════════════════╧══════════════════╝
@@ -102,11 +103,10 @@ public function setHorizontalBorderChars(string $outside, ?string $inside = null
102103
*
103104
* <code>
104105
* ╔═══════════════╤══════════════════════════╤══════════════════╗
105-
* ISBN Title │ Author ║
106-
* ╠═══════1═══════╪══════════════════════════╪══════════════════╣
106+
* 1 ISBN 2 Title │ Author ║
107+
* ╠══════════════╪══════════════════════════╪══════════════════╣
107108
* ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
108109
* ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
109-
* ╟───────2───────┼──────────────────────────┼──────────────────╢
110110
* ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
111111
* ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
112112
* ╚═══════════════╧══════════════════════════╧══════════════════╝

Tests/DependencyInjection/AddConsoleCommandPassTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,25 @@ public function testProcessInvokableCommand()
329329
$this->assertStringContainsString('usage1', $command->getUsages()[0]);
330330
}
331331

332+
public function testProcessCommandWithDescriptionWithpercentageSigns()
333+
{
334+
$container = new ContainerBuilder();
335+
$container
336+
->register(
337+
'description_with_percentage_signs_command',
338+
DescriptionWithPercentageSignsCommand::class,
339+
)
340+
->addTag('console.command')
341+
;
342+
$pass = new AddConsoleCommandPass();
343+
$pass->process($container);
344+
345+
$command = $container->get('console.command_loader')->get('description-percentage-signs');
346+
347+
self::assertTrue($container->has('description_with_percentage_signs_command.command'));
348+
self::assertSame('Just testing %percentage-signs%', $command->getDescription());
349+
}
350+
332351
public function testProcessInvokableSignalableCommand()
333352
{
334353
$container = new ContainerBuilder();
@@ -386,6 +405,14 @@ public function __invoke(): void
386405
}
387406
}
388407

408+
#[AsCommand(name: 'description-percentage-signs', description: 'Just testing %percentage-signs%')]
409+
class DescriptionWithPercentageSignsCommand
410+
{
411+
public function __invoke(): void
412+
{
413+
}
414+
}
415+
389416
#[AsCommand(name: 'invokable-signalable', description: 'Just testing', help: 'The %command.name% help content.')]
390417
class InvokableSignalableCommand implements SignalableCommandInterface
391418
{

0 commit comments

Comments
 (0)