Skip to content

Commit

Permalink
remove unused imports and typing some declaration
Browse files Browse the repository at this point in the history
Signed-off-by: Giovanni Martins <[email protected]>
  • Loading branch information
giovannism20 committed Nov 23, 2023
1 parent 5990b22 commit bd7817a
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/Command/Configure/Cfssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function configure(): void {
);
}

protected function execute(InputInterface $input, OutputInterface $output): int {
protected function execute(InputInterface $input): int {
if (!$this->installService->isCfsslBinInstalled()) {
throw new InvalidArgumentException('CFSSL binary not found! run libresign:istall --cfssl first.');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/Configure/OpenSsl.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function configure(): void {
);
}

protected function execute(InputInterface $input, OutputInterface $output): int {
protected function execute(InputInterface $input): int {
$names = [];
if (!$commonName = $input->getOption('cn')) {
throw new InvalidArgumentException('Invalid Comon Name');
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function list($page = null, $length = null): JSONResponse {
#[NoCSRFRequired]
public function getPage(string $uuid, int $page) {
try {
$page = $this->fileService->getPage($uuid, $page, $this->userSession->getUser()->getUID());
$page = $this->fileService->getPage($uuid, $page);
return new DataDisplayResponse(
$page,
Http::STATUS_OK,
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/AccountFileMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function accountFileList(array $filter, int $page = null, int $length = n
return $return;
}

private function getUserAccountFile(array $filter = [], bool $count = false): Pagination {
private function getUserAccountFile(array $filter = []): Pagination {
$qb = $this->db->getQueryBuilder();
$qb->select(
'f.id',
Expand Down
4 changes: 2 additions & 2 deletions lib/Helper/ValidateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ public function validateVisibleElementsRelation(array $list, SignRequest $signRe
throw new LibresignException($this->l10n->t('Field %s does not belong to user', $elements['profileElementId']));
}
}
$this->validateUserHasNecessaryElements($signRequest, $user, $list);
$this->validateUserHasNecessaryElements($signRequest, $list);
}

private function validateUserHasNecessaryElements(SignRequest $signRequest, IUser $user, array $list = []): void {
private function validateUserHasNecessaryElements(SignRequest $signRequest, array $list = []): void {
$fileElements = $this->fileElementMapper->getByFileIdAndSignRequestId($signRequest->getFileId(), $signRequest->getId());
$total = array_filter($fileElements, function (FileElement $fileElement) use ($list, $signRequest): bool {
$found = array_filter($list, function ($item) use ($fileElement): bool {
Expand Down
8 changes: 3 additions & 5 deletions lib/Middleware/InjectionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ private function requireSigner(): void {
}

/**
* @param Controller $controller
* @param string $methodName
* @param \Exception $exception
* @throws \Exception
* @param \Exception $exception
* @return Response
*@throws \Exception
*/
public function afterException($controller, $methodName, \Exception $exception): Response {
public function afterException(\Exception $exception): Response {
switch (true) {
case $exception instanceof LibresignException:
if ($this->isJson($exception->getMessage())) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public function formatFile(): array {
return $return;
}

public function getPage(string $uuid, int $page, string $uid): string {
public function getPage(string $uuid, int $page): string {
$libreSignFile = $this->fileMapper->getByUuid($uuid);
$uid = $this->userSession->getUser()->getUID();
if ($libreSignFile->getUserId() !== $uid) {
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/Handler/Pkcs12HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class Pkcs12HandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
private CfsslHandler|MockObject $cfsslHandler;
private IL10N|MockObject $l10n;
private JSignPdfHandler|MockObject $jSignPdfHandler;
private OpenSslHandler|MockObject $openSslHandler;
private CertificateEngineHandler|MockObject $certificateEngineHandler;
private CertificateEngineHandler|MockObject $certificateEngineHandler;
private array $cfsslHandlerBuffer = [];

public function setUp(): void {
Expand Down Expand Up @@ -112,7 +111,7 @@ public function testGetFooterWithSuccess() {
$this->config = $this->createMock(IConfig::class);
$this->config
->method('getAppValue')
->willReturnCallback(function ($appid, $key, $default) {
->willReturnCallback(function ($key) {
switch ($key) {
case 'add_footer': return 1;
case 'validation_site': return 'http://test.coop';
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/Service/SignFileServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ final class SignFileServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
private IEventDispatcher|MockObject $eventDispatcher;
private IURLGenerator|MockObject $urlGenerator;
private SignMethodService|MockObject $signMethod;
private IdentifyMethodService|MockObject $identifyMethod;
private IdentifyMethodMapper|MockObject $identifyMethodMapper;
private IdentifyMethodMapper|MockObject $identifyMethodMapper;
private ITempManager|MockObject $tempManager;

public function setUp(): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FeatureContext extends NextcloudApiContext implements OpenedEmailStorageAw
/**
* @BeforeSuite
*/
public static function beforeSuite(BeforeSuiteScope $scope) {
public static function beforeSuite() {
exec('php ../../../../occ config:system:set debug --value true --type boolean');
}

Expand Down

0 comments on commit bd7817a

Please sign in to comment.