mirror of
https://github.com/nextcloud/server.git
synced 2024-08-27 17:55:28 +02:00
fix: Adjust console formatter code to match with Symfony type hints
Symfony has added type hints on the `OutputFormatterInterface`, so we must adjust our type hints to match with Symfony. Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
This commit is contained in:
parent
698332e81d
commit
dc9d8c42bb
@ -121,6 +121,7 @@ class EncryptAllTest extends TestCase {
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
$outputFormatter->method('format')->willReturnArgument(0);
|
||||
|
||||
$this->outputInterface->expects($this->any())->method('getFormatter')
|
||||
@ -346,9 +347,11 @@ class EncryptAllTest extends TestCase {
|
||||
['/user1/files/foo/subfile'],
|
||||
);
|
||||
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
$this->outputInterface->expects($this->any())
|
||||
->method('getFormatter')
|
||||
->willReturn($this->createMock(OutputFormatterInterface::class));
|
||||
->willReturn($outputFormatter);
|
||||
$progressBar = new ProgressBar($this->outputInterface);
|
||||
|
||||
$this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
|
||||
|
@ -94,11 +94,11 @@ class TimestampFormatter implements OutputFormatterInterface {
|
||||
/**
|
||||
* Formats a message according to the given styles.
|
||||
*
|
||||
* @param string $message The message to style
|
||||
* @return string The styled message, prepended with a timestamp using the
|
||||
* @param string|null $message The message to style
|
||||
* @return string|null The styled message, prepended with a timestamp using the
|
||||
* log timezone and dateformat, e.g. "2015-06-23T17:24:37+02:00"
|
||||
*/
|
||||
public function format($message) {
|
||||
public function format(?string $message): ?string {
|
||||
if (!$this->formatter->isDecorated()) {
|
||||
// Don't add anything to the output when we shouldn't
|
||||
return $this->formatter->format($message);
|
||||
|
@ -75,6 +75,7 @@ class ChangeKeyStorageRootTest extends TestCase {
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
$outputFormatter->method('format')->willReturnArgument(0);
|
||||
|
||||
$this->outputInterface->expects($this->any())->method('getFormatter')
|
||||
|
@ -71,6 +71,7 @@ class RepairTest extends TestCase {
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
$outputFormatter->method('format')->willReturnArgument(0);
|
||||
|
||||
$this->output->expects($this->any())
|
||||
|
@ -77,12 +77,15 @@ class DecryptAllTest extends TestCase {
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->outputInterface = $this->getMockBuilder(OutputInterface::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->outputInterface->expects($this->any())->method('isDecorated')
|
||||
->willReturn(false);
|
||||
$this->userInterface = $this->getMockBuilder(UserInterface::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('format')->willReturn('foo');
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
|
||||
$this->outputInterface->expects($this->any())->method('getFormatter')
|
||||
->willReturn($outputFormatter);
|
||||
@ -304,6 +307,7 @@ class DecryptAllTest extends TestCase {
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('isDecorated')->willReturn(false);
|
||||
$outputFormatter->method('format')->willReturn('foo');
|
||||
|
||||
$output = $this->createMock(OutputInterface::class);
|
||||
|
Loading…
Reference in New Issue
Block a user