diff --git a/3rdparty b/3rdparty
index 3558cc253049d..9e360791930a8 160000
--- a/3rdparty
+++ b/3rdparty
@@ -1 +1 @@
-Subproject commit 3558cc253049d15a89760af2ecfa8bcfac4f4802
+Subproject commit 9e360791930a82b6770ba72ab0456f5ba27e543f
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index a9869af99d96c..9b6c822708328 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -37,8 +37,7 @@ protected function setUp(): void {
->disableOriginalConstructor()
->getMock();
$this->logger->expects($this->any())
- ->method('warning')
- ->willReturn(true);
+ ->method('warning');
$this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php
index f677e51d60435..0736749f6d981 100644
--- a/apps/files_external/lib/Command/Config.php
+++ b/apps/files_external/lib/Command/Config.php
@@ -73,7 +73,7 @@ protected function getOption(StorageConfig $mount, $key, OutputInterface $output
if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
$value = json_encode($value);
}
- $output->writeln($value);
+ $output->writeln((string)$value);
}
/**
diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php
index 61e974ff58957..3e6ccf751a88d 100644
--- a/apps/files_external/lib/Command/Delete.php
+++ b/apps/files_external/lib/Command/Delete.php
@@ -13,6 +13,7 @@
use OCP\AppFramework\Http;
use OCP\IUserManager;
use OCP\IUserSession;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -26,6 +27,7 @@ public function __construct(
protected UserStoragesService $userService,
protected IUserSession $userSession,
protected IUserManager $userManager,
+ protected QuestionHelper $questionHelper,
) {
parent::__construct();
}
@@ -64,6 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$listInput->setOption('output', $input->getOption('output'));
$listCommand->listMounts(null, [$mount], $listInput, $output);
+ /** @var QuestionHelper $questionHelper */
$questionHelper = $this->getHelper('question');
$question = new ConfirmationQuestion('Delete this mount? [y/N] ', false);
diff --git a/apps/files_external/lib/Command/Option.php b/apps/files_external/lib/Command/Option.php
index 6b679f1d6f7ba..6051c9c5fbdc5 100644
--- a/apps/files_external/lib/Command/Option.php
+++ b/apps/files_external/lib/Command/Option.php
@@ -38,7 +38,7 @@ protected function getOption(StorageConfig $mount, $key, OutputInterface $output
if (!is_string($value)) { // show bools and objects correctly
$value = json_encode($value);
}
- $output->writeln($value);
+ $output->writeln((string)$value);
}
/**
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index a143c6188a1fb..16fe161a9ba4d 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -44,11 +44,6 @@
-
-
-
-
-
diff --git a/core/Command/Background/Delete.php b/core/Command/Background/Delete.php
index 41efaf8466521..50ae309065b46 100644
--- a/core/Command/Background/Delete.php
+++ b/core/Command/Background/Delete.php
@@ -10,6 +10,7 @@
use OC\Core\Command\Base;
use OCP\BackgroundJob\IJobList;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -51,6 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'/^(y|Y)/i'
);
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
if (!$helper->ask($input, $output, $question)) {
$output->writeln('aborted.');
diff --git a/core/Command/Base.php b/core/Command/Base.php
index 0af5981e9422e..b915ae2ae4a3a 100644
--- a/core/Command/Base.php
+++ b/core/Command/Base.php
@@ -149,7 +149,7 @@ public function cancelOperation(): void {
$this->interrupted = true;
}
- public function run(InputInterface $input, OutputInterface $output) {
+ public function run(InputInterface $input, OutputInterface $output): int {
// check if the php pcntl_signal functions are accessible
$this->php_pcntl_signal = function_exists('pcntl_signal');
if ($this->php_pcntl_signal) {
diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php
index 461c024d03825..b1d1632ff1a74 100644
--- a/core/Command/Config/App/SetConfig.php
+++ b/core/Command/Config/App/SetConfig.php
@@ -12,6 +12,7 @@
use OCP\Exceptions\AppConfigIncorrectTypeException;
use OCP\Exceptions\AppConfigUnknownKeyException;
use OCP\IAppConfig;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -229,6 +230,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
private function ask(InputInterface $input, OutputInterface $output, string $request): bool {
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
if ($input->getOption('no-interaction')) {
return true;
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index d16e6d302312f..f5028aacaefd7 100644
--- a/core/Command/Db/ConvertFilecacheBigInt.php
+++ b/core/Command/Db/ConvertFilecacheBigInt.php
@@ -11,6 +11,7 @@
use OCP\DB\Types;
use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
@@ -89,6 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('This can take up to hours, depending on the number of files in your instance!');
if ($input->isInteractive()) {
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false);
diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php
index cd92dc5acd60d..ed29412f00bdd 100644
--- a/core/Command/Db/Migrations/GenerateCommand.php
+++ b/core/Command/Db/Migrations/GenerateCommand.php
@@ -15,6 +15,7 @@
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -117,6 +118,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$output->writeln(' - Actual: ' . $version . '');
if ($input->isInteractive()) {
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with your given version? (y/n) [n] ', false);
diff --git a/core/Command/Maintenance/RepairShareOwnership.php b/core/Command/Maintenance/RepairShareOwnership.php
index a24be53b00ef4..16675545afea7 100644
--- a/core/Command/Maintenance/RepairShareOwnership.php
+++ b/core/Command/Maintenance/RepairShareOwnership.php
@@ -14,6 +14,7 @@
use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -60,6 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('');
if (!$noConfirm) {
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Repair these shares? [y/N]', false);
diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php
index 641e204e0502b..3ccd82313002a 100644
--- a/core/Command/Preview/Repair.php
+++ b/core/Command/Preview/Repair.php
@@ -19,6 +19,7 @@
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -133,6 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('batch')) {
$output->writeln('Batch mode active: migration is started right away.');
} else {
+ /** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Should the migration be started? (y/[n]) ', false);
diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php
index da1b7ba48dd57..e8d9eef6b16c9 100644
--- a/lib/private/Console/TimestampFormatter.php
+++ b/lib/private/Console/TimestampFormatter.php
@@ -32,7 +32,7 @@ public function __construct(?IConfig $config, OutputFormatterInterface $formatte
*
* @param bool $decorated Whether to decorate the messages or not
*/
- public function setDecorated($decorated) {
+ public function setDecorated(bool $decorated) {
$this->formatter->setDecorated($decorated);
}
@@ -41,7 +41,7 @@ public function setDecorated($decorated) {
*
* @return bool true if the output will decorate messages, false otherwise
*/
- public function isDecorated() {
+ public function isDecorated(): bool {
return $this->formatter->isDecorated();
}
@@ -51,7 +51,7 @@ public function isDecorated() {
* @param string $name The style name
* @param OutputFormatterStyleInterface $style The style instance
*/
- public function setStyle($name, OutputFormatterStyleInterface $style) {
+ public function setStyle(string $name, OutputFormatterStyleInterface $style) {
$this->formatter->setStyle($name, $style);
}
@@ -61,7 +61,7 @@ public function setStyle($name, OutputFormatterStyleInterface $style) {
* @param string $name
* @return bool
*/
- public function hasStyle($name) {
+ public function hasStyle(string $name): bool {
return $this->formatter->hasStyle($name);
}
@@ -72,7 +72,7 @@ public function hasStyle($name) {
* @return OutputFormatterStyleInterface
* @throws \InvalidArgumentException When style isn't defined
*/
- public function getStyle($name) {
+ public function getStyle(string $name): OutputFormatterStyleInterface {
return $this->formatter->getStyle($name);
}
diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php
index 6848b0bb350ae..62b75191d36de 100644
--- a/tests/Core/Command/User/SettingTest.php
+++ b/tests/Core/Command/User/SettingTest.php
@@ -49,15 +49,14 @@ protected function setUp(): void {
public function getCommand(array $methods = []) {
if (empty($methods)) {
- return new Setting($this->userManager, $this->config, $this->connection);
+ return new Setting($this->userManager, $this->config);
} else {
- $mock = $this->getMockBuilder('OC\Core\Command\User\Setting')
+ $mock = $this->getMockBuilder(Setting::class)
->setConstructorArgs([
$this->userManager,
$this->config,
- $this->connection,
])
- ->setMethods($methods)
+ ->onlyMethods($methods)
->getMock();
return $mock;
}
@@ -194,7 +193,16 @@ public function testCheckInput($arguments, $options, $parameterOptions, $user, $
->willReturnMap($options);
$this->consoleInput->expects($this->any())
->method('hasParameterOption')
- ->willReturnMap($parameterOptions);
+ ->willReturnCallback(function (string|array $config, bool $default = false) use ($parameterOptions): bool {
+ foreach ($parameterOptions as $parameterOption) {
+ if ($config === $parameterOption[0]
+ // Check the default value if the maps has 3 entries
+ && (!isset($parameterOption[2]) || $default === $parameterOption[1])) {
+ return end($parameterOption);
+ }
+ }
+ return false;
+ });
if ($user !== false) {
$this->userManager->expects($this->once())
@@ -402,15 +410,16 @@ public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedRe
if ($defaultValue === null) {
$this->consoleInput->expects($this->atLeastOnce())
->method('hasParameterOption')
- ->willReturnMap([
- ['--default-value', false],
- ]);
+ ->willReturn(false);
} else {
$this->consoleInput->expects($this->atLeastOnce())
->method('hasParameterOption')
- ->willReturnMap([
- ['--default-value', false, true],
- ]);
+ ->willReturnCallback(function (string|array $config, bool $default = false): bool {
+ if ($config === '--default-value' && $default === false) {
+ return true;
+ }
+ return false;
+ });
$this->consoleInput->expects($this->once())
->method('getOption')
->with('default-value')
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index 681ec03338015..260d3aaff7684 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -91,23 +91,23 @@ public function testSetRecipients(): void {
$this->symfonyEmail
->expects($this->once())
->method('from')
- ->willReturn(new Address('pierres-general-store@stardewvalley.com', 'Pierres General Store'));
+ ->with(new Address('pierres-general-store@stardewvalley.com', 'Pierres General Store'));
$this->symfonyEmail
->expects($this->once())
->method('to')
- ->willReturn(new Address('lewis-tent@stardewvalley.com', "Lewis' Tent Life"));
+ ->with(new Address('lewis-tent@stardewvalley.com', "Lewis' Tent Life"));
$this->symfonyEmail
->expects($this->once())
->method('replyTo')
- ->willReturn(new Address('penny@stardewvalley-library.co.edu', 'Penny'));
+ ->with(new Address('penny@stardewvalley-library.co.edu', 'Penny'));
$this->symfonyEmail
->expects($this->once())
->method('cc')
- ->willReturn(new Address('gunther@stardewvalley-library.co.edu', 'Gunther'));
+ ->with(new Address('gunther@stardewvalley-library.co.edu', 'Gunther'));
$this->symfonyEmail
->expects($this->once())
->method('bcc')
- ->willReturn(new Address('pam@stardewvalley-bus.com', 'Pam'));
+ ->with(new Address('pam@stardewvalley-bus.com', 'Pam'));
$this->message->setRecipients();
}