Merge pull request #10128 from nextcloud/refactor/rector-php-sets
refactor: Apply PHP5.6-7.3 rector sets
This commit is contained in:
Коммит
83854dd4c6
|
@ -230,7 +230,7 @@ class Cache extends Horde_Imap_Client_Cache_Backend {
|
|||
* @return void
|
||||
*/
|
||||
public function setMetaData($mailbox, $data) {
|
||||
$this->_loadSliceMap($mailbox, isset($data['uidvalid']) ? $data['uidvalid'] : null);
|
||||
$this->_loadSliceMap($mailbox, $data['uidvalid'] ?? null);
|
||||
$this->_slicemap[$mailbox]['d'] = array_merge($this->_slicemap[$mailbox]['d'], $data);
|
||||
$this->_toUpdate($mailbox, 'slicemap', true);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class ExportAccount extends Command {
|
|||
$output->writeln('<info>Account ' . $account->getId() . ':</info>');
|
||||
$output->writeln('- E-Mail: ' . $account->getEmail());
|
||||
$output->writeln('- Name: ' . $account->getName());
|
||||
$output->writeln('- Provision: ' . ($account->getMailAccount()->getProvisioningId() ? 'set' : 'none'). ' ID: ' . ($account->getMailAccount()->getProvisioningId() ? $account->getMailAccount()->getProvisioningId():'N/A'));
|
||||
$output->writeln('- Provision: ' . ($account->getMailAccount()->getProvisioningId() ? 'set' : 'none'). ' ID: ' . ($account->getMailAccount()->getProvisioningId() ?: 'N/A'));
|
||||
$output->writeln('- IMAP user: ' . $account->getMailAccount()->getInboundUser());
|
||||
$output->writeln('- IMAP host: ' . $account->getMailAccount()->getInboundHost() . ':' . $account->getMailAccount()->getInboundPort() . ', security: ' . $account->getMailAccount()->getInboundSslMode());
|
||||
$output->writeln('- SMTP user: ' . $account->getMailAccount()->getOutboundUser());
|
||||
|
|
|
@ -55,7 +55,7 @@ class Cache {
|
|||
* @return void
|
||||
*/
|
||||
public function addValue(string $key, ?string $value): void {
|
||||
$this->cache->set($key, $value === null ? false : $value, self::CACHE_TTL);
|
||||
$this->cache->set($key, $value ?? false, self::CACHE_TTL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,20 +24,20 @@ class UploadedFile {
|
|||
* @return string|null
|
||||
*/
|
||||
public function getFileName() {
|
||||
return isset($this->fileData['name']) ? $this->fileData['name'] : null;
|
||||
return $this->fileData['name'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTempPath() {
|
||||
return isset($this->fileData['tmp_name']) ? $this->fileData['tmp_name'] : null;
|
||||
return $this->fileData['tmp_name'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType() {
|
||||
return isset($this->fileData['type']) ? $this->fileData['type'] : 'application/octet-stream';
|
||||
return $this->fileData['type'] ?? 'application/octet-stream';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,7 @@ return RectorConfig::configure()
|
|||
->withPreparedSets(
|
||||
phpunitCodeQuality: true,
|
||||
phpunit: true,
|
||||
)
|
||||
->withPhpSets(
|
||||
php73: true,
|
||||
);
|
||||
|
|
|
@ -104,7 +104,7 @@ class CollectedAddressMapperTest extends TestCase {
|
|||
$this->assertCount(\count($result), $matches);
|
||||
$i = 0;
|
||||
foreach ($matches as $match) {
|
||||
$this->assertInstanceOf('\OCA\Mail\Db\CollectedAddress', $match);
|
||||
$this->assertInstanceOf(\OCA\Mail\Db\CollectedAddress::class, $match);
|
||||
$this->assertContains($match->getEmail(), $result);
|
||||
$this->assertEquals($this->userId, $match->getUserId());
|
||||
$i++;
|
||||
|
|
|
@ -172,7 +172,7 @@ class RecipientMapperTest extends TestCase {
|
|||
$penny->setEmail('penny@stardewvalleylibrary.edu');
|
||||
$penny->setLabel('Penny');
|
||||
$penny->setType(Recipient::TYPE_TO);
|
||||
$this->mapper->saveRecipients($message->getId(), [$penny], Recipient::TYPE_BCC);
|
||||
$this->mapper->saveRecipients($message->getId(), [$penny]);
|
||||
|
||||
$results = $this->mapper->findByLocalMessageId($message->getId());
|
||||
$this->assertCount(1, $results);
|
||||
|
|
|
@ -151,7 +151,7 @@ class MailTransmissionIntegrationTest extends TestCase {
|
|||
public function testSendMailWithLocalAttachment() {
|
||||
$file = new UploadedFile([
|
||||
'name' => 'text.txt',
|
||||
'tmp_name' => dirname(__FILE__) . '/../../data/mail-message-123.txt',
|
||||
'tmp_name' => __DIR__ . '/../../data/mail-message-123.txt',
|
||||
]);
|
||||
|
||||
$localAttachment = $this->attachmentService->addFile($this->user->getUID(), $file);
|
||||
|
|
|
@ -41,7 +41,7 @@ class CreateAccountTest extends TestCase {
|
|||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->service = $this->getMockBuilder('\OCA\Mail\Service\AccountService')
|
||||
$this->service = $this->getMockBuilder(\OCA\Mail\Service\AccountService::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->crypto = $this->getMockBuilder('\OCP\Security\ICrypto')->getMock();
|
||||
|
|
|
@ -40,7 +40,7 @@ class AliasesControllerTest extends TestCase {
|
|||
$this->request = $this->getMockBuilder('OCP\IRequest')
|
||||
->getMock();
|
||||
|
||||
$this->alias = $this->getMockBuilder('\OCA\Mail\Db\Alias')
|
||||
$this->alias = $this->getMockBuilder(\OCA\Mail\Db\Alias::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class AutoCompleteControllerTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
|
||||
$this->service = $this->getMockBuilder('OCA\Mail\Service\AutoCompletion\AutoCompleteService')
|
||||
$this->service = $this->getMockBuilder(\OCA\Mail\Service\AutoCompletion\AutoCompleteService::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->controller = new AutoCompleteController(
|
||||
|
|
|
@ -14,11 +14,8 @@ use OCA\Mail\Http\AttachmentDownloadResponse;
|
|||
class AttachmentDownloadResponseTest extends TestCase {
|
||||
/**
|
||||
* @dataProvider providesResponseData
|
||||
* @param $content
|
||||
* @param $filename
|
||||
* @param $contentType
|
||||
*/
|
||||
public function testIt($content, $filename, $contentType) {
|
||||
public function testIt(string $content, string $filename, string $contentType) {
|
||||
$resp = new AttachmentDownloadResponse($content, $filename, $contentType);
|
||||
$headers = $resp->getHeaders();
|
||||
$this->assertEquals($content, $resp->render());
|
||||
|
|
|
@ -25,7 +25,7 @@ class ProxyDownloadResponseTest extends TestCase {
|
|||
$this->assertArrayHasKey('Content-Type', $headers);
|
||||
$this->assertEquals($contentType, $headers['Content-Type']);
|
||||
$this->assertArrayHasKey('Content-Disposition', $headers);
|
||||
$pos = strpos($headers['Content-Disposition'], $filename);
|
||||
$pos = strpos($headers['Content-Disposition'], (string)$filename);
|
||||
$this->assertTrue($pos > 0);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче