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

chore(cs): Prepare coding-standard update #13338

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Chat/CommentsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function searchForObjectsWithFilters(string $search, string $objectType,

if ($search !== '') {
$query->where($query->expr()->iLike('message', $query->createNamedParameter(
'%' . $this->dbConn->escapeLikeParameter($search). '%'
'%' . $this->dbConn->escapeLikeParameter($search) . '%'
)));
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function parseMessage(Message $chatMessage): void {
$parsedMessage = $this->l->t('You created the conversation');
} elseif ($systemIsActor) {
$parsedMessage = $this->l->t('System created the conversation');
}if ($cliIsActor) {
} elseif ($cliIsActor) {
$parsedMessage = $this->l->t('An administrator created the conversation');
}
} elseif ($message === 'conversation_renamed') {
Expand Down
10 changes: 5 additions & 5 deletions lib/Command/Developer/UpdateDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getDocumentation(Command $command): string {
$command->getUsages()
),
function ($carry, $usage) {
return $carry.'* `'.$usage.'`'."\n";
return $carry.'* `' . $usage . '`' . "\n";
}
);
$doc .= $this->describeInputDefinition($command);
Expand Down Expand Up @@ -119,23 +119,23 @@ protected function describeInputArgument(InputArgument $argument): string {
$description = $argument->getDescription();

return
'| `'.($argument->getName() ?: '<none>') . '` | ' .
'| `' . ($argument->getName() ?: '<none>') . '` | ' .
($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | ' .
($argument->isRequired() ? 'yes' : 'no') . ' | ' .
($argument->isArray() ? 'yes' : 'no') . ' | ' .
($argument->isRequired() ? '*Required*' : '`' . str_replace("\n", '', var_export($argument->getDefault(), true)) . '`') . ' |';
}

protected function describeInputOption(InputOption $option): string {
$name = '--'.$option->getName();
$name = '--' . $option->getName();
if ($option->getShortcut()) {
$name .= '\|-'.str_replace('|', '\|-', $option->getShortcut());
$name .= '\|-' . str_replace('|', '\|-', $option->getShortcut());
}
$description = $option->getDescription();

return
'| `' . $name . '` | ' .
($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | '.
($description ? preg_replace('/\s*[\r\n]\s*/', ' ', $description) : '') . ' | ' .
($option->acceptValue() ? 'yes' : 'no') . ' | ' .
($option->isValueRequired() ? 'yes' : 'no') . ' | ' .
($option->isArray() ? 'yes' : 'no') . ' | ' .
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/User/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if ($federatedRooms > 0) {
$output->writeln('<comment>Could not transfer membership in ' . $federatedRooms. ' federated rooms.</comment>');
$output->writeln('<comment>Could not transfer membership in ' . $federatedRooms . ' federated rooms.</comment>');
}

$output->writeln('<info>Added or promoted user ' . $destinationUser->getUID() . ' in ' . $modified . ' rooms.</info>');
Expand Down
2 changes: 1 addition & 1 deletion lib/Events/BeforeTurnServersGetEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BeforeTurnServersGetEvent extends Event {
* @param list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}> $servers
*/
public function __construct(
protected array $servers
protected array $servers,
) {
parent::__construct();
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Exceptions/DialOutFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
class DialOutFailedException extends \RuntimeException {
public function __construct(
string $errorCode,
protected string $readableError) {
protected string $readableError,
) {
parent::__construct($errorCode);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public function getListedRoomsForUser(string $userId, string $term = ''): array
if ($term !== '') {
$query->andWhere(
$query->expr()->iLike('name', $query->createNamedParameter(
'%' . $this->db->escapeLikeParameter($term). '%'
'%' . $this->db->escapeLikeParameter($term) . '%'
))
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/MatterbridgeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private function generateConfig(array $bridge): string {
$serverUrl = $part['server'];
} else {
$serverUrl = preg_replace('/\/+$/', '', $this->urlGenerator->getAbsoluteURL(''));
$content .= ' SeparateDisplayName = true' ."\n";
$content .= ' SeparateDisplayName = true' . "\n";
// TODO remove that
//$serverUrl = preg_replace('/https:/', 'http:', $serverUrl);
}
Expand Down Expand Up @@ -553,7 +553,7 @@ private function checkBridgeProcess(Room $room, array $bridge, bool $relaunch =
// config : no PID stored
// config : enabled => launch it
$pid = $this->launchMatterbridge($room);
$this->logger->info('Launch process, PID is '.$pid);
$this->logger->info('Launch process, PID is ' . $pid);
}
} else {
$this->logger->info('No PID defined in config AND bridge disabled in config : doing nothing');
Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/Attribute/RequirePermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RequirePermission {
public const START_CALL = 'call-start';

public function __construct(
protected string $permission
protected string $permission,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/CanUseTalkMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
protected Config $talkConfig,
protected IConfig $serverConfig,
protected IRequest $request,
protected IURLGenerator $url
protected IURLGenerator $url,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/InjectionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected function getLoggedInOrGuest(
bool $moderatorRequired,
bool $requireListedWhenNoParticipant = false,
bool $requireFederationWhenNotLoggedIn = false,
?string $sessionIdParameter = null
?string $sessionIdParameter = null,
): void {
if ($requireFederationWhenNotLoggedIn && $this->userId === null && !$this->federationAuthenticator->isFederationRequest()) {
throw new ParticipantNotFoundException();
Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/FixNamespaceInDatabaseTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function run(IOutput $output): void {
$query->select('id', 'class')
->from('jobs')
->where($query->expr()->like('class', $query->createNamedParameter(
'%' . $this->connection->escapeLikeParameter('Spreed'). '%'
'%' . $this->connection->escapeLikeParameter('Spreed') . '%'
)));

$result = $query->executeQuery();
Expand Down
4 changes: 2 additions & 2 deletions lib/Migration/Version19000Date20240709183938.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ protected function addMissingProtocol(string $table, string $column): void {
$query->update($table)
->set($column, $query->func()->concat($query->createNamedParameter('https://'), $column))
->where($query->expr()->notLike($column, $query->createNamedParameter(
$this->connection->escapeLikeParameter('http://'). '%'
$this->connection->escapeLikeParameter('http://') . '%'
)))
->andWhere($query->expr()->notLike($column, $query->createNamedParameter(
$this->connection->escapeLikeParameter('https://'). '%'
$this->connection->escapeLikeParameter('https://') . '%'
)))
->andWhere($query->expr()->nonEmptyString($column));
$query->executeStatement();
Expand Down
4 changes: 2 additions & 2 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ protected function parseStoredRecordingFail(
INotification $notification,
Room $room,
Participant $participant,
IL10N $l
IL10N $l,
): INotification {
$notification
->setRichSubject(
Expand All @@ -314,7 +314,7 @@ protected function parseStoredRecording(
INotification $notification,
Room $room,
Participant $participant,
IL10N $l
IL10N $l,
): INotification {
$parameters = $notification->getSubjectParameters();
try {
Expand Down
10 changes: 5 additions & 5 deletions lib/Service/HostedSignalingServerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
if ($body) {
$parsedBody = json_decode($body, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

$message = $this->l10n->t('Something unexpected happened.');
throw new HostedSignalingServerAPIException($message, $status);
Expand Down Expand Up @@ -198,7 +198,7 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
$data = json_decode($body, true);

if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

$message = $this->l10n->t('Something unexpected happened.');
throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
Expand Down Expand Up @@ -262,7 +262,7 @@ public function fetchAccountInfo(AccountId $accountId) {
if ($body) {
$parsedBody = json_decode($body, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

$message = $this->l10n->t('Something unexpected happened.');
throw new HostedSignalingServerAPIException($message, $status);
Expand Down Expand Up @@ -334,7 +334,7 @@ public function fetchAccountInfo(AccountId $accountId) {
$data = (array)json_decode($body, true);

if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

$message = $this->l10n->t('Something unexpected happened.');
throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
Expand Down Expand Up @@ -416,7 +416,7 @@ public function deleteAccount(AccountId $accountId): void {
if ($body) {
$parsedBody = json_decode($body, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: ' . json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);

$message = $this->l10n->t('Something unexpected happened.');
throw new HostedSignalingServerAPIException($message, $status);
Expand Down
2 changes: 1 addition & 1 deletion lib/Share/RoomShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private function addShareToDB(
string $target,
int $permissions,
string $token,
?\DateTime $expirationDate
?\DateTime $expirationDate,
): int {
$insert = $this->dbConnection->getQueryBuilder();
$insert->insert('share')
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ public function userRenamesRoom(string $user, string $identifier, string $newNam
public function userSetsDescriptionForRoomTo(string $user, string $identifier, string $description, int $statusCode, string $apiVersion): void {
$this->setCurrentUser($user);
$this->sendRequest(
'PUT', '/apps/spreed/api/' .$apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description',
'PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description',
new TableNode([['description', $description]])
);
$this->assertStatusCode($this->response, $statusCode);
Expand Down Expand Up @@ -4239,7 +4239,7 @@ private function assertReactionList(?TableNode $formData): void {
*/
public function userSetTheMessageExpirationToXWithStatusCode(string $user, int $messageExpiration, string $identifier, int $statusCode, string $apiVersion = 'v4'): void {
$this->setCurrentUser($user);
$this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/message-expiration', [
$this->sendRequest('POST', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/message-expiration', [
'seconds' => $messageExpiration,
]);
$this->assertStatusCode($this->response, $statusCode);
Expand All @@ -4250,7 +4250,7 @@ public function userSetTheMessageExpirationToXWithStatusCode(string $user, int $
*/
public function userSetsTheRecordingConsentToXWithStatusCode(string $user, int $recordingConsent, string $identifier, int $statusCode, string $apiVersion = 'v4'): void {
$this->setCurrentUser($user);
$this->sendRequest('PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/recording-consent', [
$this->sendRequest('PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/recording-consent', [
'recordingConsent' => $recordingConsent,
]);
$this->assertStatusCode($this->response, $statusCode);
Expand Down Expand Up @@ -4627,7 +4627,7 @@ public function setupOrRemoveBotViaOCSAPI(string $user, string $action, string $

$this->sendRequest(
$action === 'sets up' ? 'POST' : 'DELETE',
'/apps/spreed/api/' . $apiVersion . '/bot/' . self::$identifierToToken[$identifier] . '/' .self::$botNameToId[$botName]
'/apps/spreed/api/' . $apiVersion . '/bot/' . self::$identifierToToken[$identifier] . '/' . self::$botNameToId[$botName]
);
$this->assertStatusCode($this->response, $status);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Collaboration/Collaborators/RoomPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function testSearch(
array $roomsForParticipant,
array $expectedMatchesExact,
array $expectedMatches,
bool $expectedHasMoreResults
bool $expectedHasMoreResults,
) {
$rooms = [];
foreach ($roomsForParticipant as $roomData) {
Expand Down
Loading