Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Bump symfony/* to 6.4 #48539

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion 3rdparty
Submodule 3rdparty updated 414 files
3 changes: 1 addition & 2 deletions apps/encryption/tests/Crypto/CryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Command/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions apps/files_external/lib/Command/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,7 @@ public function __construct(
protected UserStoragesService $userService,
protected IUserSession $userSession,
protected IUserManager $userManager,
protected QuestionHelper $questionHelper,
) {
parent::__construct();
}
Expand Down Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Command/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ protected function configure(): void {
*/
protected function getOption(StorageConfig $mount, $key, OutputInterface $output): void {
$value = $mount->getMountOption($key);
if (!is_string($value)) { // show bools and objects correctly
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);
}

/**
Expand Down
33 changes: 28 additions & 5 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
<code><![CDATA[array]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="3rdparty/symfony/routing/Route.php">
<MethodSignatureMustProvideReturnType>
<code><![CDATA[unserialize]]></code>
</MethodSignatureMustProvideReturnType>
</file>
<file src="apps/dav/appinfo/v1/caldav.php">
<UndefinedGlobalVariable>
<code><![CDATA[$baseuri]]></code>
Expand Down Expand Up @@ -1271,6 +1266,12 @@
<code><![CDATA[array]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="core/Command/Config/App/SetConfig.php">
<UndefinedDocblockClass>
<code><![CDATA[$helper]]></code>
<code><![CDATA[$helper]]></code>
</UndefinedDocblockClass>
</file>
<file src="core/Command/Config/Import.php">
<InvalidScalarArgument>
<code><![CDATA[0]]></code>
Expand All @@ -1285,12 +1286,24 @@
<code><![CDATA[getFilteredValues]]></code>
</TooManyArguments>
</file>
<file src="core/Command/Db/ConvertFilecacheBigInt.php">
<UndefinedDocblockClass>
<code><![CDATA[$helper]]></code>
<code><![CDATA[$helper]]></code>
</UndefinedDocblockClass>
</file>
<file src="core/Command/Db/ConvertType.php">
<InvalidScalarArgument>
<code><![CDATA[0]]></code>
<code><![CDATA[1]]></code>
</InvalidScalarArgument>
</file>
<file src="core/Command/Db/Migrations/GenerateCommand.php">
<UndefinedDocblockClass>
<code><![CDATA[$helper]]></code>
<code><![CDATA[$helper]]></code>
</UndefinedDocblockClass>
</file>
<file src="core/Command/Encryption/Enable.php">
<NullArgument>
<code><![CDATA[null]]></code>
Expand Down Expand Up @@ -1320,7 +1333,17 @@
<code><![CDATA[updateFilecache]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="core/Command/Maintenance/RepairShareOwnership.php">
<UndefinedDocblockClass>
<code><![CDATA[$helper]]></code>
<code><![CDATA[$helper]]></code>
</UndefinedDocblockClass>
</file>
<file src="core/Command/Preview/Repair.php">
<UndefinedDocblockClass>
<code><![CDATA[$helper]]></code>
<code><![CDATA[$helper]]></code>
</UndefinedDocblockClass>
<UndefinedInterfaceMethod>
<code><![CDATA[section]]></code>
<code><![CDATA[section]]></code>
Expand Down
2 changes: 2 additions & 0 deletions core/Command/Background/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions core/Command/Config/App/SetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,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;
Expand Down
1 change: 1 addition & 0 deletions core/Command/Db/ConvertFilecacheBigInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('<comment>This can take up to hours, depending on the number of files in your instance!</comment>');

if ($input->isInteractive()) {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with the conversion (y/n)? [n] ', false);

Expand Down
1 change: 1 addition & 0 deletions core/Command/Db/Migrations/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$output->writeln('<comment> - Actual: ' . $version . '</comment>');

if ($input->isInteractive()) {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('Continue with your given version? (y/n) [n] ', false);

Expand Down
1 change: 1 addition & 0 deletions core/Command/Maintenance/RepairShareOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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);

Expand Down
1 change: 1 addition & 0 deletions core/Command/Preview/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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('<info>Should the migration be started? (y/[n]) </info>', false);

Expand Down
10 changes: 5 additions & 5 deletions lib/private/Console/TimestampFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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();
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
31 changes: 20 additions & 11 deletions tests/Core/Command/User/SettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions tests/lib/Mail/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,23 @@ public function testSetRecipients(): void {
$this->symfonyEmail
->expects($this->once())
->method('from')
->willReturn(new Address('[email protected]', 'Pierres General Store'));
->with(new Address('[email protected]', 'Pierres General Store'));
$this->symfonyEmail
->expects($this->once())
->method('to')
->willReturn(new Address('[email protected]', "Lewis' Tent Life"));
->with(new Address('[email protected]', "Lewis' Tent Life"));
$this->symfonyEmail
->expects($this->once())
->method('replyTo')
->willReturn(new Address('[email protected]', 'Penny'));
->with(new Address('[email protected]', 'Penny'));
$this->symfonyEmail
->expects($this->once())
->method('cc')
->willReturn(new Address('[email protected]', 'Gunther'));
->with(new Address('[email protected]', 'Gunther'));
$this->symfonyEmail
->expects($this->once())
->method('bcc')
->willReturn(new Address('[email protected]', 'Pam'));
->with(new Address('[email protected]', 'Pam'));

$this->message->setRecipients();
}
Expand Down
Loading