From e75ec7c20af6672b37870de16f718c916e2ba73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 16 Sep 2024 15:24:19 +0200 Subject: [PATCH 1/9] fix: Add psalm configuration, fix some of the errors, add stubs, add baseline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- composer.json | 4 + lib/AppInfo/Application.php | 4 +- lib/BackgroundJob/AddPhotoJob.php | 18 +- .../LaunchUsersInstallScanJob.php | 15 +- lib/BackgroundJob/LookupMissingGeoJob.php | 22 +- lib/BackgroundJob/UpdatePhotoByFileJob.php | 18 +- lib/BackgroundJob/UserInstallScanJob.php | 7 +- lib/Command/RegisterMimetypes.php | 1 - lib/Controller/ContactsController.php | 6 +- lib/Controller/DevicesController.php | 13 +- lib/Controller/FavoritesController.php | 5 +- lib/Controller/PageController.php | 23 +- lib/Controller/PublicContactsController.php | 36 +- .../PublicFavoritePageController.php | 4 +- .../PublicFavoritesApiController.php | 3 - lib/Controller/PublicFavoritesController.php | 17 +- lib/Controller/PublicPageController.php | 32 +- lib/Controller/PublicPhotosController.php | 23 +- lib/Controller/PublicTracksController.php | 13 +- lib/Controller/PublicUtilsController.php | 12 +- lib/DB/DeviceShareMapper.php | 15 +- lib/DB/FavoriteShareMapper.php | 1 + lib/DB/GeophotoMapper.php | 1 + lib/Helper/ExifGeoData.php | 11 +- lib/Listener/CardCreatedListener.php | 1 + lib/Listener/CardDeletedListener.php | 1 + lib/Listener/CardUpdatedListener.php | 1 + .../LoadAdditionalScriptsListener.php | 1 + lib/Listener/LoadSidebarListener.php | 1 + lib/Migration/InstallScan.php | 21 +- lib/Service/DevicesService.php | 16 +- lib/Service/FavoritesService.php | 18 +- lib/Service/GeophotoService.php | 7 +- lib/Service/MyMapsService.php | 28 +- lib/Service/TracksService.php | 18 +- lib/Settings/AdminSettings.php | 24 +- psalm.xml | 39 + tests/psalm-baseline.xml | 106 + tests/stubs/oc_archive_archive.php | 118 + tests/stubs/oc_archive_zip.php | 140 ++ .../oc_files_search_searchbinaryoperator.php | 55 + .../oc_files_search_searchcomparison.php | 66 + tests/stubs/oc_files_search_searchquery.php | 66 + tests/stubs/oc_hooks_emitter.php | 39 + .../oc_security_csp_contentsecuritypolicy.php | 184 ++ tests/stubs/oc_share_constants.php | 73 + tests/stubs/oc_user_nouserexception.php | 11 + .../stubs/oca_dav_carddav_carddavbackend.php | 494 +++++ .../stubs/oca_dav_events_cardcreatedevent.php | 65 + .../stubs/oca_dav_events_carddeletedevent.php | 65 + .../stubs/oca_dav_events_cardupdatedevent.php | 65 + ...files_event_loadadditionalscriptsevent.php | 19 + tests/stubs/oca_files_event_loadsidebar.php | 14 + ...ring_event_beforetemplaterenderedevent.php | 46 + tests/stubs/oca_viewer_event_loadviewer.php | 36 + vendor-bin/psalm/composer.json | 9 + vendor-bin/psalm/composer.lock | 1949 +++++++++++++++++ 57 files changed, 3845 insertions(+), 255 deletions(-) create mode 100644 psalm.xml create mode 100644 tests/psalm-baseline.xml create mode 100644 tests/stubs/oc_archive_archive.php create mode 100644 tests/stubs/oc_archive_zip.php create mode 100644 tests/stubs/oc_files_search_searchbinaryoperator.php create mode 100644 tests/stubs/oc_files_search_searchcomparison.php create mode 100644 tests/stubs/oc_files_search_searchquery.php create mode 100644 tests/stubs/oc_hooks_emitter.php create mode 100644 tests/stubs/oc_security_csp_contentsecuritypolicy.php create mode 100644 tests/stubs/oc_share_constants.php create mode 100644 tests/stubs/oc_user_nouserexception.php create mode 100644 tests/stubs/oca_dav_carddav_carddavbackend.php create mode 100644 tests/stubs/oca_dav_events_cardcreatedevent.php create mode 100644 tests/stubs/oca_dav_events_carddeletedevent.php create mode 100644 tests/stubs/oca_dav_events_cardupdatedevent.php create mode 100644 tests/stubs/oca_files_event_loadadditionalscriptsevent.php create mode 100644 tests/stubs/oca_files_event_loadsidebar.php create mode 100644 tests/stubs/oca_files_sharing_event_beforetemplaterenderedevent.php create mode 100644 tests/stubs/oca_viewer_event_loadviewer.php create mode 100644 vendor-bin/psalm/composer.json create mode 100644 vendor-bin/psalm/composer.lock diff --git a/composer.json b/composer.json index 00612ab96..0fa3289c7 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,10 @@ "cs:fix": "php-cs-fixer fix", "cs:check": "php-cs-fixer fix --dry-run --diff", "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "psalm": "psalm.phar --threads=1", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", + "psalm:clear": "psalm.phar --clear-cache && psalm.phar --clear-global-cache", + "psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", "test:integration": "phpunit -c tests/phpunit.integration.xml --fail-on-warning", "test:integration:dev": "phpunit -c tests/phpunit.integration.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure", "test:unit": "phpunit -c tests/phpunit.unit.xml --fail-on-warning", diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e867e6f62..bfa00e614 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -74,8 +74,8 @@ public function boot(IBootContext $context): void { $context->getAppContainer()->registerService('FileHooks', function ($c) { return new FileHooks( $c->query(IServerContainer::class)->getRootFolder(), - \OC::$server->query(PhotofilesService::class), - \OC::$server->query(TracksService::class), + \OCP\Server::get(PhotofilesService::class), + \OCP\Server::get(TracksService::class), $c->query(IServerContainer::class)->getLogger(), $c->query('AppName'), $c->query(IServerContainer::class)->getLockingProvider() diff --git a/lib/BackgroundJob/AddPhotoJob.php b/lib/BackgroundJob/AddPhotoJob.php index 0871078c3..d5f98bff0 100644 --- a/lib/BackgroundJob/AddPhotoJob.php +++ b/lib/BackgroundJob/AddPhotoJob.php @@ -42,10 +42,12 @@ class AddPhotoJob extends QueuedJob { * @param ITimeFactory $timeFactory * @param PhotofilesService $photofilesService */ - public function __construct(ITimeFactory $timeFactory, + public function __construct( + ITimeFactory $timeFactory, IRootFolder $root, PhotofilesService $photofilesService, - ICacheFactory $cacheFactory) { + ICacheFactory $cacheFactory, + ) { parent::__construct($timeFactory); $this->photofilesService = $photofilesService; $this->root = $root; @@ -53,16 +55,16 @@ public function __construct(ITimeFactory $timeFactory, $this->backgroundJobCache = $this->cacheFactory->createDistributed('maps:background-jobs'); } - public function run($arguments) { - $userFolder = $this->root->getUserFolder($arguments['userId']); - $files = $userFolder->getById($arguments['photoId']); + public function run($argument) { + $userFolder = $this->root->getUserFolder($argument['userId']); + $files = $userFolder->getById($argument['photoId']); if (empty($files)) { return; } $file = array_shift($files); - $this->photofilesService->addPhotoNow($file, $arguments['userId']); + $this->photofilesService->addPhotoNow($file, $argument['userId']); - $counter = $this->backgroundJobCache->get('recentlyAdded:'.$arguments['userId']) ?? 0; - $this->backgroundJobCache->set('recentlyAdded:'.$arguments['userId'], (int)$counter + 1, 60 * 60 * 3); + $counter = $this->backgroundJobCache->get('recentlyAdded:'.$argument['userId']) ?? 0; + $this->backgroundJobCache->set('recentlyAdded:'.$argument['userId'], (int)$counter + 1, 60 * 60 * 3); } } diff --git a/lib/BackgroundJob/LaunchUsersInstallScanJob.php b/lib/BackgroundJob/LaunchUsersInstallScanJob.php index 047a611a7..2edb7a293 100644 --- a/lib/BackgroundJob/LaunchUsersInstallScanJob.php +++ b/lib/BackgroundJob/LaunchUsersInstallScanJob.php @@ -17,11 +17,10 @@ use OCP\BackgroundJob\QueuedJob; use OCP\IUser; use OCP\IUserManager; +use Psr\Log\LoggerInterface; class LaunchUsersInstallScanJob extends QueuedJob { - private $jobList; - /** * LaunchUsersInstallScanJob constructor. * @@ -29,14 +28,16 @@ class LaunchUsersInstallScanJob extends QueuedJob { * * @param IJobList $jobList */ - public function __construct(ITimeFactory $timeFactory, IJobList $jobList, IUserManager $userManager) { + public function __construct( + ITimeFactory $timeFactory, + private IJobList $jobList, + private IUserManager $userManager, + ) { parent::__construct($timeFactory); - $this->jobList = $jobList; - $this->userManager = $userManager; } - public function run($arguments) { - \OC::$server->getLogger()->debug('Launch users install scan jobs cronjob executed'); + public function run($argument) { + \OCP\Server::get(LoggerInterface::class)->debug('Launch users install scan jobs cronjob executed'); $this->userManager->callForSeenUsers(function (IUser $user) { $this->jobList->add(UserInstallScanJob::class, ['userId' => $user->getUID()]); }); diff --git a/lib/BackgroundJob/LookupMissingGeoJob.php b/lib/BackgroundJob/LookupMissingGeoJob.php index 4dc977f51..4c2f171da 100644 --- a/lib/BackgroundJob/LookupMissingGeoJob.php +++ b/lib/BackgroundJob/LookupMissingGeoJob.php @@ -16,31 +16,25 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\QueuedJob; +use Psr\Log\LoggerInterface; class LookupMissingGeoJob extends QueuedJob { - /** @var AddressService */ - private $addressService; - - /** @var AddressService */ - private $jobList; - /** * LookupMissingGeoJob constructor. * * A QueuedJob to lookup missing geo information of addresses - * - * @param AddressService $service - * @param IJobList $jobList */ - public function __construct(ITimeFactory $timeFactory, AddressService $service, IJobList $jobList) { + public function __construct( + ITimeFactory $timeFactory, + private AddressService $addressService, + private IJobList $jobList, + ) { parent::__construct($timeFactory); - $this->addressService = $service; - $this->jobList = $jobList; } - public function run($arguments) { - \OC::$server->getLogger()->debug('Maps address lookup cronjob executed'); + public function run($argument) { + \OCP\Server::get(LoggerInterface::class)->debug('Maps address lookup cronjob executed'); // lookup at most 200 addresses if (!$this->addressService->lookupMissingGeo(200)) { // if not all addresses where looked up successfully add a new job for next time diff --git a/lib/BackgroundJob/UpdatePhotoByFileJob.php b/lib/BackgroundJob/UpdatePhotoByFileJob.php index 0d45aa9c4..f08af37f4 100644 --- a/lib/BackgroundJob/UpdatePhotoByFileJob.php +++ b/lib/BackgroundJob/UpdatePhotoByFileJob.php @@ -39,13 +39,13 @@ class UpdatePhotoByFileJob extends QueuedJob { * * A QueuedJob to scan user storage for photos and tracks * - * @param ITimeFactory $timeFactory - * @param PhotofilesService $photofilesService */ - public function __construct(ITimeFactory $timeFactory, + public function __construct( + ITimeFactory $timeFactory, IRootFolder $root, PhotofilesService $photofilesService, - ICacheFactory $cacheFactory) { + ICacheFactory $cacheFactory, + ) { parent::__construct($timeFactory); $this->photofilesService = $photofilesService; $this->root = $root; @@ -53,16 +53,16 @@ public function __construct(ITimeFactory $timeFactory, $this->backgroundJobCache = $this->cacheFactory->createDistributed('maps:background-jobs'); } - public function run($arguments) { - $userFolder = $this->root->getUserFolder($arguments['userId']); - $files = $userFolder->getById($arguments['fileId']); + public function run($argument) { + $userFolder = $this->root->getUserFolder($argument['userId']); + $files = $userFolder->getById($argument['fileId']); if (empty($files)) { return; } $file = array_shift($files); $this->photofilesService->updateByFileNow($file); - $counter = $this->backgroundJobCache->get('recentlyUpdated:'.$arguments['userId']) ?? 0; - $this->backgroundJobCache->set('recentlyUpdated:'.$arguments['userId'], (int)$counter + 1, 60 * 60 * 3); + $counter = $this->backgroundJobCache->get('recentlyUpdated:'.$argument['userId']) ?? 0; + $this->backgroundJobCache->set('recentlyUpdated:'.$argument['userId'], (int)$counter + 1, 60 * 60 * 3); } } diff --git a/lib/BackgroundJob/UserInstallScanJob.php b/lib/BackgroundJob/UserInstallScanJob.php index 73d190089..3e3b0c86c 100644 --- a/lib/BackgroundJob/UserInstallScanJob.php +++ b/lib/BackgroundJob/UserInstallScanJob.php @@ -20,6 +20,7 @@ use OCP\IConfig; use OCP\IUserManager; +use Psr\Log\LoggerInterface; class UserInstallScanJob extends QueuedJob { @@ -49,9 +50,9 @@ public function __construct(ITimeFactory $timeFactory, IJobList $jobList, $this->tracksService = $tracksService; } - public function run($arguments) { - $userId = $arguments['userId']; - \OC::$server->getLogger()->debug('Launch user install scan job for '.$userId.' cronjob executed'); + public function run($argument) { + $userId = $argument['userId']; + \OCP\Server::get(LoggerInterface::class)->debug('Launch user install scan job for '.$userId.' cronjob executed'); // scan photos and tracks for given user $this->rescanUserPhotos($userId); $this->rescanUserTracks($userId); diff --git a/lib/Command/RegisterMimetypes.php b/lib/Command/RegisterMimetypes.php index e766cde36..dcb8434dd 100644 --- a/lib/Command/RegisterMimetypes.php +++ b/lib/Command/RegisterMimetypes.php @@ -40,7 +40,6 @@ protected function configure() { * @return int */ protected function execute(InputInterface $input, OutputInterface $output): int { - $this->output = $output; $output->writeln('Register mimetypes for existing files'); $this->mimetypeService->registerForExistingFiles(); $output->writeln('Register mimetypes for new files'); diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php index 814f8650d..0062736d1 100644 --- a/lib/Controller/ContactsController.php +++ b/lib/Controller/ContactsController.php @@ -12,7 +12,6 @@ namespace OCA\Maps\Controller; -use OC\Files\Node\Node; use OCA\DAV\CardDAV\CardDavBackend; use OCA\Maps\Service\AddressService; use OCP\AppFramework\Controller; @@ -21,6 +20,7 @@ use OCP\Contacts\IManager; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\IRootFolder; +use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\IAvatarManager; use OCP\IDBConnection; @@ -83,7 +83,7 @@ public function __construct( /** * Converts a geo string as a float array * @param string formatted as "lat;lon" - * @return float array containing [lat;lon] + * @return float[] array containing [lat;lon] */ private function geoAsFloatArray($geo) { $res = array_map(function ($value) {return floatval($value);}, explode(';', $geo)); @@ -116,7 +116,7 @@ private function isNewAddress($prevGeo, $geo) { * get distance between two geo points * @param GPS coordinates of first point * @param GPS coordinates of second point - * @return Distance in meters between these two points + * @return float Distance in meters between these two points */ private function getDistance($coordsA, $coordsB) { if (empty($coordsA) || empty($coordsB)) { diff --git a/lib/Controller/DevicesController.php b/lib/Controller/DevicesController.php index 05fcbe8d8..fee5dcd9f 100644 --- a/lib/Controller/DevicesController.php +++ b/lib/Controller/DevicesController.php @@ -11,19 +11,15 @@ namespace OCA\Maps\Controller; -use OCA\Files_External\NotFoundException; use OCA\Maps\DB\DeviceShareMapper; use OCA\Maps\Service\DevicesService; - use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; - use OCP\Files\IRootFolder; - - +use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\IConfig; use OCP\IDateTimeZone; @@ -229,11 +225,10 @@ public function deleteDevice($id): DataResponse { /** * @NoAdminRequired - * @param null $deviceIdList - * @param $begin - * @param $end + * @param ?array $deviceIdList + * @param int $begin + * @param int $end * @param bool $all=false - * @return DataResponse * @throws \OCP\Files\NotFoundException * @throws \OCP\Files\NotPermittedException */ diff --git a/lib/Controller/FavoritesController.php b/lib/Controller/FavoritesController.php index 3b46a9757..09a1d1fdc 100644 --- a/lib/Controller/FavoritesController.php +++ b/lib/Controller/FavoritesController.php @@ -22,6 +22,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\Files\NotFoundException; +use OCP\Files\Folder; use OCP\IConfig; use OCP\IDateTimeZone; use OCP\IGroupManager; @@ -404,7 +405,7 @@ public function addShareCategoryToMap(string $category, int $targetMapId, ?int $ } $folders = $this->userFolder->getById($targetMapId); $folder = array_shift($folders); - if (is_null($folder)) { + if (!($folder instanceof Folder)) { return new DataResponse($this->l->t('Map not Found'), 404); } try { @@ -463,7 +464,7 @@ public function exportFavorites(?array $categoryList = null, ?int $begin = null, } if ($userFolder->nodeExists('/Maps')) { $mapsFolder = $userFolder->get('/Maps'); - if ($mapsFolder->getType() !== \OCP\Files\FileInfo::TYPE_FOLDER) { + if (!($mapsFolder instanceof Folder)) { $response = new DataResponse($this->l->t('/Maps is not a directory'), 400); return $response; } elseif (!$mapsFolder->isCreatable()) { diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 949094b9e..f97e3f0bc 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -21,23 +21,16 @@ use OCP\IRequest; class PageController extends Controller { - private $userId; - private $config; - /** @var IEventDispatcher */ - private $eventDispatcher; - - public function __construct($AppName, + public function __construct( + string $appName, IRequest $request, - IEventDispatcher $eventDispatcher, - IConfig $config, - IInitialStateService $initialStateService, - $UserId) { - parent::__construct($AppName, $request); - $this->userId = $UserId; - $this->eventDispatcher = $eventDispatcher; - $this->config = $config; - $this->initialStateService = $initialStateService; + private IEventDispatcher $eventDispatcher, + private IConfig $config, + private IInitialStateService $initialStateService, + private string $userId, + ) { + parent::__construct($appName, $request); } /** diff --git a/lib/Controller/PublicContactsController.php b/lib/Controller/PublicContactsController.php index 2e2bda39b..76b9cf180 100644 --- a/lib/Controller/PublicContactsController.php +++ b/lib/Controller/PublicContactsController.php @@ -12,7 +12,6 @@ namespace OCA\Maps\Controller; -use OC\Files\Node\Node; use OCA\DAV\CardDAV\CardDavBackend; use OCA\Maps\Service\AddressService; use OCP\AppFramework\Http\DataDisplayResponse; @@ -21,6 +20,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; +use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\IAvatarManager; @@ -33,6 +33,7 @@ use OCP\IUserManager; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as ShareManager; +use OCP\Share\IShare; use Sabre\VObject\Reader; class PublicContactsController extends PublicPageController { @@ -43,39 +44,23 @@ class PublicContactsController extends PublicPageController { protected IAvatarManager $avatarManager; protected IRootFolder $root; - /** - * @param $appName - * @param IRequest $request - * @param IEventDispatcher $eventDispatcher - * @param IConfig $config - * @param IInitialStateService $initialStateService - * @param IURLGenerator $urlGenerator - * @param ShareManager $shareManager - * @param IUserManager $userManager - * @param ISession $session - * @param IDBConnection $dbconnection - * @param IManager $contactsManager - * @param AddressService $addressService - * @param CardDavBackend $cdBackend - * @param IAvatarManager $avatarManager - * @param IRootFolder $root - */ - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, + ISession $session, + IURLGenerator $urlGenerator, IEventDispatcher $eventDispatcher, IConfig $config, IInitialStateService $initialStateService, - IURLGenerator $urlGenerator, ShareManager $shareManager, IUserManager $userManager, - ISession $session, IManager $contactsManager, IDBConnection $dbconnection, AddressService $addressService, CardDavBackend $cdBackend, IAvatarManager $avatarManager, IRootFolder $root) { - parent::__construct($appName, $request, $eventDispatcher, $config, $initialStateService, $urlGenerator, $shareManager, $userManager, $session); + parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); $this->avatarManager = $avatarManager; $this->contactsManager = $contactsManager; $this->addressService = $addressService; @@ -86,11 +71,8 @@ public function __construct($appName, /** * Validate the permissions of the share - * - * @param Share\IShare $share - * @return bool */ - private function validateShare(\OCP\Share\IShare $share) { + private function validateShare(IShare $share): bool { // If the owner is disabled no access to the link is granted $owner = $this->userManager->get($share->getShareOwner()); if ($owner === null || !$owner->isEnabled()) { @@ -107,7 +89,7 @@ private function validateShare(\OCP\Share\IShare $share) { } /** - * @return \OCP\Share\IShare + * @return IShare * @throws NotFoundException */ private function getShare() { diff --git a/lib/Controller/PublicFavoritePageController.php b/lib/Controller/PublicFavoritePageController.php index 4aa56b352..af17d1b61 100644 --- a/lib/Controller/PublicFavoritePageController.php +++ b/lib/Controller/PublicFavoritePageController.php @@ -36,6 +36,7 @@ use OCP\ILogger; use OCP\IRequest; use OCP\ISession; +use OCP\IUserManager; use OCP\Util; class PublicFavoritePageController extends PublicShareController { @@ -85,7 +86,7 @@ public function sharedFavoritesCategory($token) { $response = new PublicTemplateResponse('maps', 'public/favorites_index', []); - $ownerName = OC::$server->getUserManager()->get($share->getOwner())->getDisplayName(); + $ownerName = \OCP\Server::get(IUserManager::class)->get($share->getOwner())->getDisplayName(); $response->setHeaderTitle($share->getCategory()); $response->setHeaderDetails('shared by ' . $ownerName); @@ -101,7 +102,6 @@ public function sharedFavoritesCategory($token) { * To ensure access is blocked when the password to a share is changed we store * a hash of the password for this token. * - * @return string * @since 14.0.0 */ protected function getPasswordHash(): string { diff --git a/lib/Controller/PublicFavoritesApiController.php b/lib/Controller/PublicFavoritesApiController.php index b09fe2d5b..a9d82ebc5 100644 --- a/lib/Controller/PublicFavoritesApiController.php +++ b/lib/Controller/PublicFavoritesApiController.php @@ -55,9 +55,6 @@ public function __construct( $this->favoritesService = $favoritesService; } - /** - * @return string - */ public function getPasswordHash(): string { return ''; } diff --git a/lib/Controller/PublicFavoritesController.php b/lib/Controller/PublicFavoritesController.php index 28de1d763..f86252620 100644 --- a/lib/Controller/PublicFavoritesController.php +++ b/lib/Controller/PublicFavoritesController.php @@ -34,6 +34,7 @@ use OCP\IUserManager; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; +use Psr\Log\LoggerInterface; class PublicFavoritesController extends PublicPageController { @@ -48,27 +49,28 @@ class PublicFavoritesController extends PublicPageController { /* @var FavoriteShareMapper */ private $favoriteShareMapper; - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, + ISession $session, + IURLGenerator $urlGenerator, IServerContainer $serverContainer, IConfig $config, - IURLGenerator $urlGenerator, IInitialStateService $initialStateService, IManager $shareManager, IAppManager $appManager, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, + private LoggerInterface $logger, FavoritesService $favoritesService, IDateTimeZone $dateTimeZone, - ISession $session, FavoriteShareMapper $favoriteShareMapper, - IEventDispatcher $eventDispatcher) { - parent::__construct($appName, $request, $eventDispatcher, $config, $initialStateService, $urlGenerator, $shareManager, $userManager, $session); + IEventDispatcher $eventDispatcher, + ) { + parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); $this->favoritesService = $favoritesService; $this->dateTimeZone = $dateTimeZone; - $this->logger = $logger; $this->appName = $appName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userManager = $userManager; @@ -86,7 +88,6 @@ public function __construct($appName, /** * Validate the permissions of the share * - * @param Share\IShare $share * @return bool */ private function validateShare(\OCP\Share\IShare $share) { diff --git a/lib/Controller/PublicPageController.php b/lib/Controller/PublicPageController.php index e347fb714..055ca9d27 100644 --- a/lib/Controller/PublicPageController.php +++ b/lib/Controller/PublicPageController.php @@ -22,34 +22,29 @@ use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IInitialStateService; -use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as ShareManager; +use OCP\Share\IShare; class PublicPageController extends AuthPublicShareController { - protected InitialStateService $initialStateService; - protected IConfig $config; - protected ILogger $logger; - protected \OCP\Activity\IManager $activityManager; - protected IEventDispatcher $eventDispatcher; - protected ShareManager $shareManager; - protected IUserManager $userManager; - - public function __construct($AppName, + protected IShare $share; + + public function __construct( + string $appName, IRequest $request, - IEventDispatcher $eventDispatcher, - IConfig $config, - IInitialStateService $initialStateService, + ISession $session, IURLGenerator $urlGenerator, - ShareManager $shareManager, - IUserManager $userManager, - ISession $session + protected IEventDispatcher $eventDispatcher, + protected IConfig $config, + protected IInitialStateService $initialStateService, + protected ShareManager $shareManager, + protected IUserManager $userManager, ) { - parent::__construct($AppName, $request, $session, $urlGenerator); + parent::__construct($appName, $request, $session, $urlGenerator); $this->eventDispatcher = $eventDispatcher; $this->config = $config; $this->initialStateService = $initialStateService; @@ -71,7 +66,7 @@ protected function verifyPassword(string $password): bool { return $this->shareManager->checkPassword($this->share, $password); } - protected function getPasswordHash(): string { + protected function getPasswordHash(): ?string { return $this->share->getPassword(); } @@ -82,7 +77,6 @@ protected function isPasswordProtected(): bool { /** * Validate the permissions of the share * - * @param Share\IShare $share * @return bool */ private function validateShare(\OCP\Share\IShare $share) { diff --git a/lib/Controller/PublicPhotosController.php b/lib/Controller/PublicPhotosController.php index 644d33ea2..23005d9e3 100644 --- a/lib/Controller/PublicPhotosController.php +++ b/lib/Controller/PublicPhotosController.php @@ -30,32 +30,27 @@ use OCP\Share\IManager as ShareManager; class PublicPhotosController extends PublicPageController { - protected GeophotoService $geophotoService; - protected PhotofilesService $photofilesService; - protected IRootFolder $root; - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, + ISession $session, + IURLGenerator $urlGenerator, IEventDispatcher $eventDispatcher, IConfig $config, IInitialStateService $initialStateService, - IURLGenerator $urlGenerator, ShareManager $shareManager, IUserManager $userManager, - ISession $session, - GeophotoService $GeophotoService, - PhotofilesService $photofilesService, - IRootFolder $root) { - parent::__construct($appName, $request, $eventDispatcher, $config, $initialStateService, $urlGenerator, $shareManager, $userManager, $session); - $this->geophotoService = $GeophotoService; - $this->photofilesService = $photofilesService; - $this->root = $root; + protected GeophotoService $geophotoService, + protected PhotofilesService $photofilesService, + protected IRootFolder $root, + ) { + parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); } /** * Validate the permissions of the share * - * @param Share\IShare $share * @return bool */ private function validateShare(\OCP\Share\IShare $share) { diff --git a/lib/Controller/PublicTracksController.php b/lib/Controller/PublicTracksController.php index 1b2e12679..7eedb5a31 100644 --- a/lib/Controller/PublicTracksController.php +++ b/lib/Controller/PublicTracksController.php @@ -20,9 +20,6 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IInitialStateService; - - - use OCP\IL10N; use OCP\ILogger; use OCP\IRequest; @@ -31,7 +28,6 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Share; - use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as ShareManager; @@ -48,7 +44,8 @@ class PublicTracksController extends PublicPageController { protected $appName; protected IRootFolder $root; - public function __construct($appName, + public function __construct( + string $appName, IRequest $request, IEventDispatcher $eventDispatcher, IConfig $config, @@ -58,15 +55,14 @@ public function __construct($appName, IUserManager $userManager, ISession $session, IServerContainer $serverContainer, - IGroupManager $groupManager, + protected IGroupManager $groupManager, IL10N $l, ILogger $logger, TracksService $tracksService, IRootFolder $root) { - parent::__construct($appName, $request, $eventDispatcher, $config, $initialStateService, $urlGenerator, $shareManager, $userManager, $session); + parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); $this->tracksService = $tracksService; $this->logger = $logger; - $this->groupManager = $groupManager; $this->l = $l; $this->root = $root; } @@ -74,7 +70,6 @@ public function __construct($appName, /** * Validate the permissions of the share * - * @param Share\IShare $share * @return bool */ private function validateShare(\OCP\Share\IShare $share) { diff --git a/lib/Controller/PublicUtilsController.php b/lib/Controller/PublicUtilsController.php index e934f87b4..0550842c2 100644 --- a/lib/Controller/PublicUtilsController.php +++ b/lib/Controller/PublicUtilsController.php @@ -17,13 +17,11 @@ use OCP\Files\GenericFileException; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; - use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IRequest; - use OCP\ISession; use OCP\IURLGenerator; use OCP\IUserManager; @@ -35,25 +33,25 @@ class PublicUtilsController extends PublicPageController { protected IRootFolder $root; - public function __construct(string $appName, + public function __construct( + string $appName, IRequest $request, - IConfig $config, + ISession $session, IURLGenerator $urlGenerator, + IConfig $config, IInitialStateService $initialStateService, IUserManager $userManager, ShareManager $shareManager, - ISession $session, IRootFolder $root, IEventDispatcher $eventDispatcher ) { - parent::__construct($appName, $request, $eventDispatcher, $config, $initialStateService, $urlGenerator, $shareManager, $userManager, $session); + parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); $this->root = $root; } /** * Validate the permissions of the share * - * @param Share\IShare $share * @return bool */ private function validateShare(\OCP\Share\IShare $share) { diff --git a/lib/DB/DeviceShareMapper.php b/lib/DB/DeviceShareMapper.php index 32e04b2f0..8a2238aea 100644 --- a/lib/DB/DeviceShareMapper.php +++ b/lib/DB/DeviceShareMapper.php @@ -36,6 +36,7 @@ use OCP\IDBConnection; use OCP\Security\ISecureRandom; +/** @template-extends QBMapper */ class DeviceShareMapper extends QBMapper { /* @var ISecureRandom */ private $secureRandom; @@ -50,7 +51,7 @@ public function __construct(IDBConnection $db, ISecureRandom $secureRandom, IRoo /** * @param string $token - * @return Entity|null + * @return DeviceShare|null * @throws DoesNotExistException * @throws MultipleObjectsReturnedException */ @@ -68,7 +69,7 @@ public function findByToken($token) { /** * @param string[] $token - * @return Entity[]|null + * @return DeviceShare[]|null * @throws DoesNotExistException */ public function findByTokens($tokens) { @@ -87,7 +88,7 @@ public function findByTokens($tokens) { * @param $deviceId * @param $timestampFrom * @param $timestampTo - * @return Entity + * @return DeviceShare */ public function create($deviceId, $timestampFrom, $timestampTo): Entity { $token = $this->secureRandom->generate( @@ -107,7 +108,7 @@ public function create($deviceId, $timestampFrom, $timestampTo): Entity { /** * @param $deviceId - * @return Entity[] + * @return DeviceShare[] * @throws DoesNotExistException */ public function findByDeviceId($deviceId) { @@ -124,7 +125,7 @@ public function findByDeviceId($deviceId) { /** * @param $deviceIds - * @return Entity[] + * @return DeviceShare[] */ public function findByDeviceIds($deviceIds) { $qb = $this->db->getQueryBuilder(); @@ -183,7 +184,7 @@ public function removeByMapIdAndDeviceId($userId, $mapId, $deviceId) { /** * @param $id - * @return Entity|null + * @return DeviceShare|null * @throws DoesNotExistException * @throws Exception * @throws MultipleObjectsReturnedException @@ -206,7 +207,7 @@ public function findById($id) { */ public function removeById($id) { try { - $entity = $this->findByDeviceId($id); + $entity = $this->findById($id); $this->delete($entity); } catch (DoesNotExistException) { return false; diff --git a/lib/DB/FavoriteShareMapper.php b/lib/DB/FavoriteShareMapper.php index 54753412c..105be5fdd 100644 --- a/lib/DB/FavoriteShareMapper.php +++ b/lib/DB/FavoriteShareMapper.php @@ -35,6 +35,7 @@ use OCP\IDBConnection; use OCP\Security\ISecureRandom; +/** @template-extends QBMapper */ class FavoriteShareMapper extends QBMapper { /* @var ISecureRandom */ private $secureRandom; diff --git a/lib/DB/GeophotoMapper.php b/lib/DB/GeophotoMapper.php index 1b9a2b0e0..372c4eef1 100644 --- a/lib/DB/GeophotoMapper.php +++ b/lib/DB/GeophotoMapper.php @@ -16,6 +16,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; +/** @template-extends QBMapper */ class GeophotoMapper extends QBMapper { public function __construct(IDBConnection $db) { diff --git a/lib/Helper/ExifGeoData.php b/lib/Helper/ExifGeoData.php index 1c330e84f..d109762d4 100644 --- a/lib/Helper/ExifGeoData.php +++ b/lib/Helper/ExifGeoData.php @@ -209,7 +209,7 @@ final private function __construct(array $exif_data) { } /** - * @param false $invalidate_zero_iland + * @param bool $invalidate_zero_iland * @throws ExifDataInvalidException * @throws ExifDataNoLocationException */ @@ -246,10 +246,7 @@ public function isValid(): bool { return $this->is_valid; } - /** - * @return bool - */ - private function parse() { + private function parse(): void { if ($this->isValid() && ($this->latitude === null || $this->longitude === null)) { $this->longitude = $this->geo2float($this->exif_data[self::LONGITUDE]); if (isset($this->exif_data[self::LONGITUDE_REF]) && $this->exif_data[self::LONGITUDE_REF] === 'W') { @@ -353,10 +350,8 @@ public function timestamp(?string $format = 'Y-m-d H:i:s') { /** * If someone wants to have it as a json object - * - * @return array */ - public function jsonSerialize() { + public function jsonSerialize(): array { return [ 'lat' => $this->lat, 'lng' => $this->lng, diff --git a/lib/Listener/CardCreatedListener.php b/lib/Listener/CardCreatedListener.php index 592d925c1..f14787c39 100644 --- a/lib/Listener/CardCreatedListener.php +++ b/lib/Listener/CardCreatedListener.php @@ -29,6 +29,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\ILogger; +/** @template-implements IEventListener */ class CardCreatedListener implements IEventListener { /** @var AddressService */ diff --git a/lib/Listener/CardDeletedListener.php b/lib/Listener/CardDeletedListener.php index 91e67185e..2c377bcfb 100644 --- a/lib/Listener/CardDeletedListener.php +++ b/lib/Listener/CardDeletedListener.php @@ -29,6 +29,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\ILogger; +/** @template-implements IEventListener */ class CardDeletedListener implements IEventListener { /** @var AddressService */ diff --git a/lib/Listener/CardUpdatedListener.php b/lib/Listener/CardUpdatedListener.php index 4729f5537..05d2e13ba 100644 --- a/lib/Listener/CardUpdatedListener.php +++ b/lib/Listener/CardUpdatedListener.php @@ -29,6 +29,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\ILogger; +/** @template-implements IEventListener */ class CardUpdatedListener implements IEventListener { /** @var AddressService */ diff --git a/lib/Listener/LoadAdditionalScriptsListener.php b/lib/Listener/LoadAdditionalScriptsListener.php index 8b68bb868..134a405aa 100644 --- a/lib/Listener/LoadAdditionalScriptsListener.php +++ b/lib/Listener/LoadAdditionalScriptsListener.php @@ -28,6 +28,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\Util; +/** @template-implements IEventListener */ class LoadAdditionalScriptsListener implements IEventListener { public function __construct() { diff --git a/lib/Listener/LoadSidebarListener.php b/lib/Listener/LoadSidebarListener.php index 37723ca87..f0761769d 100644 --- a/lib/Listener/LoadSidebarListener.php +++ b/lib/Listener/LoadSidebarListener.php @@ -28,6 +28,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\Util; +/** @template-implements IEventListener */ class LoadSidebarListener implements IEventListener { public function __construct() { diff --git a/lib/Migration/InstallScan.php b/lib/Migration/InstallScan.php index 079221d72..99128cdb9 100644 --- a/lib/Migration/InstallScan.php +++ b/lib/Migration/InstallScan.php @@ -27,12 +27,10 @@ use OCP\BackgroundJob\IJobList; use OCP\Encryption\IManager; use OCP\IConfig; - use OCP\IDBConnection; use OCP\IUser; use OCP\IUserManager; use OCP\Migration\IOutput; - use OCP\Migration\IRepairStep; /** @@ -42,20 +40,12 @@ */ class InstallScan implements IRepairStep { - /** @var IDBConnection */ - private $connection; - - /** @var IConfig */ - private $config; - - - public function __construct(IDBConnection $connection, - IConfig $config, - IUserManager $userManager, - IJobList $jobList, - IManager $encryptionManager + public function __construct( + private IConfig $config, + private IUserManager $userManager, + private IJobList $jobList, + private IManager $encryptionManager ) { - $this->connection = $connection; $this->config = $config; $this->jobList = $jobList; $this->encryptionManager = $encryptionManager; @@ -84,7 +74,6 @@ public function run(IOutput $output) { $output->warning('Encryption is enabled. Installation photos/tracks scan aborted.'); return 1; } - $this->output = $output; // set the install scan flag for existing users // future users won't have any value and won't be bothered by "media scan" warning diff --git a/lib/Service/DevicesService.php b/lib/Service/DevicesService.php index c7cd9340f..db1a3ce72 100644 --- a/lib/Service/DevicesService.php +++ b/lib/Service/DevicesService.php @@ -12,19 +12,17 @@ namespace OCA\Maps\Service; +use OC\Archive\ZIP; use OCP\DB\Exception; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\NotFoundException; use OCP\IDBConnection; use OCP\IL10N; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class DevicesService { - private $l10n; - private $logger; private $qb; - private $dbconnection; private $importUserId; private $currentXmlTag; private $importDevName; @@ -35,10 +33,11 @@ class DevicesService { private $pointIndex; private $insideTrk; - public function __construct(ILogger $logger, IL10N $l10n, IDBConnection $dbconnection) { - $this->l10n = $l10n; - $this->logger = $logger; - $this->dbconnection = $dbconnection; + public function __construct( + private LoggerInterface $logger, + private IL10N $l10n, + private IDBConnection $dbconnection, + ) { $this->qb = $dbconnection->getQueryBuilder(); } @@ -699,7 +698,6 @@ public function importDevicesFromKml($userId, $fp, $name) { 'Exception in '.$name.' parsing at line '. xml_get_current_line_number($xml_parser).' : '. xml_error_string(xml_get_error_code($xml_parser)), - ['app' => $this->appName] ); return 0; } diff --git a/lib/Service/FavoritesService.php b/lib/Service/FavoritesService.php index f57c65c30..800896bd5 100644 --- a/lib/Service/FavoritesService.php +++ b/lib/Service/FavoritesService.php @@ -16,32 +16,36 @@ namespace OCA\Maps\Service; use OC\Archive\ZIP; -use OC\Security\SecureRandom; +use OCP\Security\ISecureRandom; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\IL10N; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class FavoritesService { private $l10n; - private $logger; private $qb; private $dbconnection; private $secureRandom; private $currentFavorite; private $currentFavoritesList; + private ?string $currentXmlTag; private $insideWpt; private $nbImported; private $importUserId; private $kmlInsidePlacemark; private $kmlCurrentCategory; - - public function __construct(ILogger $logger, IL10N $l10n, SecureRandom $secureRandom, - IDBConnection $dbconnection) { + private bool $linesFound = false; + + public function __construct( + private LoggerInterface $logger, + IL10N $l10n, + ISecureRandom $secureRandom, + IDBConnection $dbconnection, + ) { $this->l10n = $l10n; - $this->logger = $logger; $this->secureRandom = $secureRandom; $this->dbconnection = $dbconnection; $this->qb = $dbconnection->getQueryBuilder(); diff --git a/lib/Service/GeophotoService.php b/lib/Service/GeophotoService.php index 2d8e1f96d..41ca799b2 100644 --- a/lib/Service/GeophotoService.php +++ b/lib/Service/GeophotoService.php @@ -18,6 +18,7 @@ use OC\User\NoUserException; use OCA\Maps\DB\GeophotoMapper; use OCP\DB\Exception; +use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; @@ -85,7 +86,7 @@ public function clearCache(string $userId = ''): bool { /** * @param string $userId - * @param null $folder =null + * @param ?Folder $folder =null * @param bool $respectNomediaAndNoimage =true * @param bool $hideImagesOnCustomMaps =true * @param bool $hideImagesInMapsFolder @@ -169,7 +170,7 @@ public function getAll(string $userId, $folder = null, bool $respectNomediaAndNo /** * @param string $userId - * @param null $folder =null + * @param ?Folder $folder =null * @param bool $respectNomediaAndNoimage * @param bool $hideImagesOnCustomMaps * @param bool $hideImagesInMapsFolder @@ -339,7 +340,7 @@ private function loadTimeorderedPointSets(string $userId, $folder = null, bool $ $res = $userFolder->getById($gpxfile['file_id']); if (is_array($res) and count($res) > 0) { $file = array_shift($res); - if ($file->getType() === \OCP\Files\FileInfo::TYPE_FILE) { + if ($file instanceof File) { foreach ($this->getTracksFromGPX($file->getContent()) as $i => $track) { $this->timeorderedPointSets['track:' . $gpxfile['id'] . ':' . $i] = $this->getTimeorderdPointsFromTrack($track); } diff --git a/lib/Service/MyMapsService.php b/lib/Service/MyMapsService.php index c0a2360aa..c4a58c2da 100644 --- a/lib/Service/MyMapsService.php +++ b/lib/Service/MyMapsService.php @@ -14,22 +14,20 @@ use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchQuery; -use OC\OCS\Exception; use OC\User\NoUserException; +use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\Files\Search\ISearchComparison; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class MyMapsService { - private $logger; - private $root; - - public function __construct(ILogger $logger, IRootFolder $root) { - $this->logger = $logger; - $this->root = $root; + public function __construct( + private LoggerInterface $logger, + private IRootFolder $root, + ) { } public function addMyMap($newName, $userId, $counter = 0) { @@ -39,7 +37,7 @@ public function addMyMap($newName, $userId, $counter = 0) { } if ($userFolder->nodeExists('/Maps')) { $mapsFolder = $userFolder->get('/Maps'); - if ($mapsFolder->getType() !== \OCP\Files\FileInfo::TYPE_FOLDER) { + if (!($mapsFolder instanceof Folder)) { $response = '/Maps is not a directory'; return $response; } elseif (!$mapsFolder->isCreatable()) { @@ -154,6 +152,9 @@ public function updateMyMap($id, $values, $userId) { $userFolder = $this->root->getUserFolder($userId); $folders = $userFolder->getById($id); $folder = array_shift($folders); + if (!($folder instanceof Folder)) { + return []; + } try { $file = $folder->get('.index.maps'); } catch (NotFoundException $e) { @@ -180,7 +181,7 @@ public function updateMyMap($id, $values, $userId) { if ($folder->getParent()->getId() === $mapsFolder->getId()) { try { $folder->move($mapsFolder->getPath().'/'.$newName); - } catch (Exception $e) { + } catch (\Exception $e) { } } } @@ -193,19 +194,22 @@ public function deleteMyMap($id, $userId) { $folders = $userFolder->getById($id); $folder = array_shift($folders); + if (!($folder instanceof Folder)) { + return 1; + } if ($userFolder->nodeExists('/Maps')) { $mapsFolder = $userFolder->get('/Maps'); if ($folder->getParent()->getId() === $mapsFolder->getId()) { try { $folder->delete(); - } catch (Exception $e) { + } catch (\Exception $e) { return 1; } } else { try { $file = $folder->get('.index.maps'); $file->delete(); - } catch (Exception $e) { + } catch (\Exception $e) { return 1; } } diff --git a/lib/Service/TracksService.php b/lib/Service/TracksService.php index 0e85fa6d5..96402ee16 100644 --- a/lib/Service/TracksService.php +++ b/lib/Service/TracksService.php @@ -26,24 +26,22 @@ use OCP\IL10N; use OCP\ILogger; use OCP\Share\IManager; +use Psr\Log\LoggerInterface; class TracksService { public const TRACK_MIME_TYPES = ['application/gpx+xml']; - private $l10n; - private $logger; private $qb; - private $root; - private $shareManager; - public function __construct(ILogger $logger, IL10N $l10n, IRootFolder $root, - IManager $shareManager, IDBConnection $dbconnection) { - $this->l10n = $l10n; - $this->logger = $logger; + public function __construct( + private LoggerInterface $logger, + private IL10N $l10n, + private IRootFolder $root, + private IManager $shareManager, + IDBConnection $dbconnection, + ) { $this->qb = $dbconnection->getQueryBuilder(); - $this->root = $root; - $this->shareManager = $shareManager; } public function rescan($userId) { diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 7665991ba..1ba7bc842 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -2,7 +2,6 @@ namespace OCA\Maps\Settings; -use bantu\IniGetWrapper\IniGetWrapper; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IL10N; @@ -12,27 +11,10 @@ class AdminSettings implements ISettings { - /** @var IniGetWrapper */ - private $iniWrapper; - - /** @var IRequest */ - private $request; - private $config; - private $dataDirPath; - private $urlGenerator; - private $l; - public function __construct( - IniGetWrapper $iniWrapper, - IL10N $l, - IRequest $request, - IConfig $config, - IURLGenerator $urlGenerator) { - $this->urlGenerator = $urlGenerator; - $this->iniWrapper = $iniWrapper; - $this->request = $request; - $this->l = $l; - $this->config = $config; + private IL10N $l, + private IConfig $config, + ) { } /** diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 000000000..527fe3a28 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml new file mode 100644 index 000000000..8e195fdfc --- /dev/null +++ b/tests/psalm-baseline.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ele]]> + ele]]> + time]]> + time]]> + ele]]> + ele]]> + time]]> + time]]> + + + diff --git a/tests/stubs/oc_archive_archive.php b/tests/stubs/oc_archive_archive.php new file mode 100644 index 000000000..f481d0545 --- /dev/null +++ b/tests/stubs/oc_archive_archive.php @@ -0,0 +1,118 @@ + + */ + public function getAllFilesStat() + { + } + + /** + * Return stat information for the given path + * + * @param string path path to get stat information on + * @return ?array stat information or null if not found + */ + public function getStat(string $path): ?array + { + } + + /** + * get all files in the archive + */ + public function getFiles(): array + { + } + + /** + * get the content of a file + * @return string|false + */ + public function getFile(string $path) + { + } + + /** + * extract a single file from the archive + */ + public function extractFile(string $path, string $dest): bool + { + } + + /** + * extract the archive + */ + public function extract(string $dest): bool + { + } + + /** + * check if a file or folder exists in the archive + */ + public function fileExists(string $path): bool + { + } + + /** + * remove a file or folder from the archive + */ + public function remove(string $path): bool + { + } + + /** + * get a file handler + * @return bool|resource + */ + public function getStream(string $path, string $mode) + { + } + + /** + * write back temporary files + */ + public function writeBack(string $tmpFile, string $path): void + { + } +} diff --git a/tests/stubs/oc_files_search_searchbinaryoperator.php b/tests/stubs/oc_files_search_searchbinaryoperator.php new file mode 100644 index 000000000..df25aa9c5 --- /dev/null +++ b/tests/stubs/oc_files_search_searchbinaryoperator.php @@ -0,0 +1,55 @@ + display name + */ + protected array $userDisplayNames; + + public function __construct( + private IDBConnection $db, + private Principal $principalBackend, + private IUserManager $userManager, + private IEventDispatcher $dispatcher, + private Sharing\Backend $sharingBackend, + ) { + } + + /** + * Return the number of address books for a principal + * + * @param $principalUri + * @return int + */ + public function getAddressBooksForUserCount($principalUri) + { + } + + /** + * Returns the list of address books for a specific user. + * + * Every addressbook should have the following properties: + * id - an arbitrary unique id + * uri - the 'basename' part of the url + * principaluri - Same as the passed parameter + * + * Any additional clark-notation property may be passed besides this. Some + * common ones are : + * {DAV:}displayname + * {urn:ietf:params:xml:ns:carddav}addressbook-description + * {http://calendarserver.org/ns/}getctag + * + * @param string $principalUri + * @return array + */ + public function getAddressBooksForUser($principalUri) + { + } + + public function getUsersOwnAddressBooks($principalUri) + { + } + + /** + * @param int $addressBookId + */ + public function getAddressBookById(int $addressBookId): ?array + { + } + + public function getAddressBooksByUri(string $principal, string $addressBookUri): ?array + { + } + + /** + * Updates properties for an address book. + * + * The list of mutations is stored in a Sabre\DAV\PropPatch object. + * To do the actual updates, you must tell this object which properties + * you're going to process with the handle() method. + * + * Calling the handle method is like telling the PropPatch object "I + * promise I can handle updating this property". + * + * Read the PropPatch documentation for more info and examples. + * + * @param string $addressBookId + * @param \Sabre\DAV\PropPatch $propPatch + * @return void + */ + public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) + { + } + + /** + * Creates a new address book + * + * @param string $principalUri + * @param string $url Just the 'basename' of the url. + * @param array $properties + * @return int + * @throws BadRequest + */ + public function createAddressBook($principalUri, $url, array $properties) + { + } + + /** + * Deletes an entire addressbook and all its contents + * + * @param mixed $addressBookId + * @return void + */ + public function deleteAddressBook($addressBookId) + { + } + + /** + * Returns all cards for a specific addressbook id. + * + * This method should return the following properties for each card: + * * carddata - raw vcard data + * * uri - Some unique url + * * lastmodified - A unix timestamp + * + * It's recommended to also return the following properties: + * * etag - A unique etag. This must change every time the card changes. + * * size - The size of the card in bytes. + * + * If these last two properties are provided, less time will be spent + * calculating them. If they are specified, you can also omit carddata. + * This may speed up certain requests, especially with large cards. + * + * @param mixed $addressbookId + * @return array + */ + public function getCards($addressbookId) + { + } + + /** + * Returns a specific card. + * + * The same set of properties must be returned as with getCards. The only + * exception is that 'carddata' is absolutely required. + * + * If the card does not exist, you must return false. + * + * @param mixed $addressBookId + * @param string $cardUri + * @return array + */ + public function getCard($addressBookId, $cardUri) + { + } + + /** + * Returns a list of cards. + * + * This method should work identical to getCard, but instead return all the + * cards in the list as an array. + * + * If the backend supports this, it may allow for some speed-ups. + * + * @param mixed $addressBookId + * @param array $uris + * @return array + */ + public function getMultipleCards($addressBookId, array $uris) + { + } + + /** + * Creates a new card. + * + * The addressbook id will be passed as the first argument. This is the + * same id as it is returned from the getAddressBooksForUser method. + * + * The cardUri is a base uri, and doesn't include the full path. The + * cardData argument is the vcard body, and is passed as a string. + * + * It is possible to return an ETag from this method. This ETag is for the + * newly created resource, and must be enclosed with double quotes (that + * is, the string itself must contain the double quotes). + * + * You should only return the ETag if you store the carddata as-is. If a + * subsequent GET request on the same card does not have the same body, + * byte-by-byte and you did return an ETag here, clients tend to get + * confused. + * + * If you don't return an ETag, you can just return null. + * + * @param mixed $addressBookId + * @param string $cardUri + * @param string $cardData + * @param bool $checkAlreadyExists + * @return string + */ + public function createCard($addressBookId, $cardUri, $cardData, bool $checkAlreadyExists = true) + { + } + + /** + * Updates a card. + * + * The addressbook id will be passed as the first argument. This is the + * same id as it is returned from the getAddressBooksForUser method. + * + * The cardUri is a base uri, and doesn't include the full path. The + * cardData argument is the vcard body, and is passed as a string. + * + * It is possible to return an ETag from this method. This ETag should + * match that of the updated resource, and must be enclosed with double + * quotes (that is: the string itself must contain the actual quotes). + * + * You should only return the ETag if you store the carddata as-is. If a + * subsequent GET request on the same card does not have the same body, + * byte-by-byte and you did return an ETag here, clients tend to get + * confused. + * + * If you don't return an ETag, you can just return null. + * + * @param mixed $addressBookId + * @param string $cardUri + * @param string $cardData + * @return string + */ + public function updateCard($addressBookId, $cardUri, $cardData) + { + } + + /** + * @throws Exception + */ + public function moveCard(int $sourceAddressBookId, int $targetAddressBookId, string $cardUri, string $oldPrincipalUri): bool + { + } + + /** + * Deletes a card + * + * @param mixed $addressBookId + * @param string $cardUri + * @return bool + */ + public function deleteCard($addressBookId, $cardUri) + { + } + + /** + * The getChanges method returns all the changes that have happened, since + * the specified syncToken in the specified address book. + * + * This function should return an array, such as the following: + * + * [ + * 'syncToken' => 'The current synctoken', + * 'added' => [ + * 'new.txt', + * ], + * 'modified' => [ + * 'modified.txt', + * ], + * 'deleted' => [ + * 'foo.php.bak', + * 'old.txt' + * ] + * ]; + * + * The returned syncToken property should reflect the *current* syncToken + * of the calendar, as reported in the {http://sabredav.org/ns}sync-token + * property. This is needed here too, to ensure the operation is atomic. + * + * If the $syncToken argument is specified as null, this is an initial + * sync, and all members should be reported. + * + * The modified property is an array of nodenames that have changed since + * the last token. + * + * The deleted property is an array with nodenames, that have been deleted + * from collection. + * + * The $syncLevel argument is basically the 'depth' of the report. If it's + * 1, you only have to report changes that happened only directly in + * immediate descendants. If it's 2, it should also include changes from + * the nodes below the child collections. (grandchildren) + * + * The $limit argument allows a client to specify how many results should + * be returned at most. If the limit is not specified, it should be treated + * as infinite. + * + * If the limit (infinite or not) is higher than you're willing to return, + * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * + * If the syncToken is expired (due to data cleanup) or unknown, you must + * return null. + * + * The limit is 'suggestive'. You are free to ignore it. + * + * @param string $addressBookId + * @param string $syncToken + * @param int $syncLevel + * @param int|null $limit + * @return array + */ + public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) + { + } + + /** + * Adds a change record to the addressbookchanges table. + * + * @param mixed $addressBookId + * @param string $objectUri + * @param int $operation 1 = add, 2 = modify, 3 = delete + * @return void + */ + protected function addChange(int $addressBookId, string $objectUri, int $operation): void + { + } + + /** + * @param list $add + * @param list $remove + */ + public function updateShares(IShareable $shareable, array $add, array $remove): void + { + } + + /** + * Search contacts in a specific address-book + * + * @param int $addressBookId + * @param string $pattern which should match within the $searchProperties + * @param array $searchProperties defines the properties within the query pattern should match + * @param array $options = array() to define the search behavior + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped, otherwise they are + * - 'limit' - Set a numeric limit for the search results + * - 'offset' - Set the offset for the limited search results + * - 'wildcard' - Whether the search should use wildcards + * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, wildcard?: bool} $options + * @return array an array of contacts which are arrays of key-value-pairs + */ + public function search($addressBookId, $pattern, $searchProperties, $options = []): array + { + } + + /** + * Search contacts in all address-books accessible by a user + * + * @param string $principalUri + * @param string $pattern + * @param array $searchProperties + * @param array $options + * @return array + */ + public function searchPrincipalUri(string $principalUri, string $pattern, array $searchProperties, array $options = []): array + { + } + + /** + * @param int $bookId + * @param string $name + * @return array + */ + public function collectCardProperties($bookId, $name) + { + } + + /** + * get URI from a given contact + * + * @param int $id + * @return string + */ + public function getCardUri($id) + { + } + + /** + * return contact with the given URI + * + * @param int $addressBookId + * @param string $uri + * @returns array + */ + public function getContact($addressBookId, $uri) + { + } + + /** + * Returns the list of people whom this address book is shared with. + * + * Every element in this array should have the following properties: + * * href - Often a mailto: address + * * commonName - Optional, for example a first + last name + * * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants. + * * readOnly - boolean + * + * @return list + */ + public function getShares(int $addressBookId): array + { + } + + /** + * update properties table + * + * @param int $addressBookId + * @param string $cardUri + * @param string $vCardSerialized + */ + protected function updateProperties($addressBookId, $cardUri, $vCardSerialized) + { + } + + /** + * read vCard data into a vCard object + * + * @param string $cardData + * @return VCard + */ + protected function readCard($cardData) + { + } + + /** + * delete all properties from a given card + * + * @param int $addressBookId + * @param int $cardId + */ + protected function purgeProperties($addressBookId, $cardId) + { + } + + /** + * Get ID from a given contact + */ + protected function getCardId(int $addressBookId, string $uri): int + { + } + + /** + * For shared address books the sharee is set in the ACL of the address book + * + * @param int $addressBookId + * @param list $acl + * @return list + */ + public function applyShareAcl(int $addressBookId, array $acl): array + { + } + + /** + * @throws \InvalidArgumentException + */ + public function pruneOutdatedSyncTokens(int $keep, int $retention): int + { + } +} diff --git a/tests/stubs/oca_dav_events_cardcreatedevent.php b/tests/stubs/oca_dav_events_cardcreatedevent.php new file mode 100644 index 000000000..7238d46b6 --- /dev/null +++ b/tests/stubs/oca_dav_events_cardcreatedevent.php @@ -0,0 +1,65 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +namespace OCA\Viewer\Event; + +use OCP\EventDispatcher\Event; + +/** + * This event is triggered whenever the viewer is loaded and extensions should be loaded. + * + * @since 17.0.0 + * @psalm-immutable + */ +class LoadViewer extends Event { +} diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json new file mode 100644 index 000000000..ce5dec09b --- /dev/null +++ b/vendor-bin/psalm/composer.json @@ -0,0 +1,9 @@ +{ + "require-dev": { + "psalm/phar": "^5.26", + "nextcloud/ocp": "dev-master", + "doctrine/dbal": "^3.7.0", + "symfony/console": "^5.4.24", + "sabre/dav": "4.6.0" + } +} diff --git a/vendor-bin/psalm/composer.lock b/vendor-bin/psalm/composer.lock new file mode 100644 index 000000000..6b66cae30 --- /dev/null +++ b/vendor-bin/psalm/composer.lock @@ -0,0 +1,1949 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "0573d44334b923099e7db706ddfecb55", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/cache", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.2.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2022-05-20T20:07:39+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.9.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", + "reference": "d7dc08f98cba352b2bab5d32c5e58f7e745c11a7", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", + "doctrine/event-manager": "^1|^2", + "php": "^7.4 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" + }, + "require-dev": { + "doctrine/coding-standard": "12.0.0", + "fig/log-test": "^1", + "jetbrains/phpstorm-stubs": "2023.1", + "phpstan/phpstan": "1.12.0", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "9.6.20", + "psalm/plugin-phpunit": "0.18.4", + "slevomat/coding-standard": "8.13.1", + "squizlabs/php_codesniffer": "3.10.2", + "symfony/cache": "^5.4|^6.0|^7.0", + "symfony/console": "^4.4|^5.4|^6.0|^7.0", + "vimeo/psalm": "4.30.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.9.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2024-09-01T13:49:23+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/b680156fa328f1dfd874fd48c7026c41570b9c6e", + "reference": "b680156fa328f1dfd874fd48c7026c41570b9c6e", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/common": "<2.9" + }, + "require-dev": { + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^10.5", + "vimeo/psalm": "^5.24" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/2.0.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2024-05-22T20:47:39+00:00" + }, + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "ea81724d48cdf04e450fd959b4f67c06561254c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/ea81724d48cdf04e450fd959b4f67c06561254c7", + "reference": "ea81724d48cdf04e450fd959b4f67c06561254c7", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2 || ~8.3", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "31.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2024-09-16T00:43:43+00:00" + }, + { + "name": "psalm/phar", + "version": "5.26.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.26.1" + }, + "time": "2024-09-09T16:22:43+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "sabre/dav", + "version": "4.6.0", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/dav.git", + "reference": "554145304b4a026477d130928d16e626939b0b2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/554145304b4a026477d130928d16e626939b0b2a", + "reference": "554145304b4a026477d130928d16e626939b0b2a", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-dom": "*", + "ext-iconv": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "ext-spl": "*", + "lib-libxml": ">=2.7.0", + "php": "^7.1.0 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "sabre/event": "^5.0", + "sabre/http": "^5.0.5", + "sabre/uri": "^2.0", + "sabre/vobject": "^4.2.1", + "sabre/xml": "^2.0.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.19", + "monolog/monolog": "^1.27 || ^2.0", + "phpstan/phpstan": "^0.12 || ^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" + }, + "suggest": { + "ext-curl": "*", + "ext-imap": "*", + "ext-pdo": "*" + }, + "bin": [ + "bin/sabredav", + "bin/naturalselection" + ], + "type": "library", + "autoload": { + "psr-4": { + "Sabre\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "WebDAV Framework for PHP", + "homepage": "http://sabre.io/", + "keywords": [ + "CalDAV", + "CardDAV", + "WebDAV", + "framework", + "iCalendar" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/dav/issues", + "source": "https://github.com/fruux/sabre-dav" + }, + "time": "2023-12-11T13:01:23+00:00" + }, + { + "name": "sabre/event", + "version": "5.1.7", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/event.git", + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/event/zipball/86d57e305c272898ba3c28e9bd3d65d5464587c2", + "reference": "86d57e305c272898ba3c28e9bd3d65d5464587c2", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/coroutine.php", + "lib/Loop/functions.php", + "lib/Promise/functions.php" + ], + "psr-4": { + "Sabre\\Event\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "sabre/event is a library for lightweight event-based programming", + "homepage": "http://sabre.io/event/", + "keywords": [ + "EventEmitter", + "async", + "coroutine", + "eventloop", + "events", + "hooks", + "plugin", + "promise", + "reactor", + "signal" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/event/issues", + "source": "https://github.com/fruux/sabre-event" + }, + "time": "2024-08-27T11:23:05+00:00" + }, + { + "name": "sabre/http", + "version": "5.1.12", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/http.git", + "reference": "dedff73f3995578bc942fa4c8484190cac14f139" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/http/zipball/dedff73f3995578bc942fa4c8484190cac14f139", + "reference": "dedff73f3995578bc942fa4c8484190cac14f139", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-curl": "*", + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabre/event": ">=4.0 <6.0", + "sabre/uri": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1||^3.63", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" + }, + "suggest": { + "ext-curl": " to make http requests with the Client class" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Sabre\\HTTP\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "The sabre/http library provides utilities for dealing with http requests and responses. ", + "homepage": "https://github.com/fruux/sabre-http", + "keywords": [ + "http" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/http/issues", + "source": "https://github.com/fruux/sabre-http" + }, + "time": "2024-08-27T16:07:41+00:00" + }, + { + "name": "sabre/uri", + "version": "2.3.4", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/uri.git", + "reference": "b76524c22de90d80ca73143680a8e77b1266c291" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/b76524c22de90d80ca73143680a8e77b1266c291", + "reference": "b76524c22de90d80ca73143680a8e77b1266c291", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.63", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "^9.6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Sabre\\Uri\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "Functions for making sense out of URIs.", + "homepage": "http://sabre.io/uri/", + "keywords": [ + "rfc3986", + "uri", + "url" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/uri/issues", + "source": "https://github.com/fruux/sabre-uri" + }, + "time": "2024-08-27T12:18:16+00:00" + }, + { + "name": "sabre/vobject", + "version": "4.5.5", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/vobject.git", + "reference": "7148cf57d25aaba0a49f6656d37c35e8175b3087" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/7148cf57d25aaba0a49f6656d37c35e8175b3087", + "reference": "7148cf57d25aaba0a49f6656d37c35e8175b3087", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabre/xml": "^2.1 || ^3.0 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/php-invoker": "^2.0 || ^3.1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "suggest": { + "hoa/bench": "If you would like to run the benchmark scripts" + }, + "bin": [ + "bin/vobject", + "bin/generate_vcards" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sabre\\VObject\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Dominik Tobschall", + "email": "dominik@fruux.com", + "homepage": "http://tobschall.de/", + "role": "Developer" + }, + { + "name": "Ivan Enderlin", + "email": "ivan.enderlin@hoa-project.net", + "homepage": "http://mnt.io/", + "role": "Developer" + } + ], + "description": "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects", + "homepage": "http://sabre.io/vobject/", + "keywords": [ + "availability", + "freebusy", + "iCalendar", + "ical", + "ics", + "jCal", + "jCard", + "recurrence", + "rfc2425", + "rfc2426", + "rfc2739", + "rfc4770", + "rfc5545", + "rfc5546", + "rfc6321", + "rfc6350", + "rfc6351", + "rfc6474", + "rfc6638", + "rfc6715", + "rfc6868", + "vCalendar", + "vCard", + "vcf", + "xCal", + "xCard" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/vobject/issues", + "source": "https://github.com/fruux/sabre-vobject" + }, + "time": "2024-07-02T08:48:52+00:00" + }, + { + "name": "sabre/xml", + "version": "2.2.11", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/xml.git", + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/xml/zipball/01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", + "reference": "01a7927842abf3e10df3d9c2d9b0cc9d813a3fcc", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "lib-libxml": ">=2.6.20", + "php": "^7.1 || ^8.0", + "sabre/uri": ">=1.0,<3.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1||3.63.2", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Deserializer/functions.php", + "lib/Serializer/functions.php" + ], + "psr-4": { + "Sabre\\Xml\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Markus Staab", + "email": "markus.staab@redaxo.de", + "role": "Developer" + } + ], + "description": "sabre/xml is an XML library that you may not hate.", + "homepage": "https://sabre.io/xml/", + "keywords": [ + "XMLReader", + "XMLWriter", + "dom", + "xml" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/xml/issues", + "source": "https://github.com/fruux/sabre-xml" + }, + "time": "2024-09-06T07:37:46+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.43", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "e86f8554de667c16dde8aeb89a3990cfde924df9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/e86f8554de667c16dde8aeb89a3990cfde924df9", + "reference": "e86f8554de667c16dde8aeb89a3990cfde924df9", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.43" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-08-13T16:31:56+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:32:20+00:00" + }, + { + "name": "symfony/string", + "version": "v6.4.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.4.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-08-12T09:55:28+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +} From 06f7656ace2a0d74d352a8323105fb545d97ece0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 16 Sep 2024 18:20:26 +0200 Subject: [PATCH 2/9] chore: Add stubs folder to ignore list for code style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .php-cs-fixer.dist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e247c5973..812a8f898 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,9 +10,10 @@ $config ->getFinder() ->ignoreVCSIgnored(true) - ->notPath('build') + ->notPath('tests/stubs') ->notPath('l10n') ->notPath('src') ->notPath('vendor') + ->notPath('vendor-bin') ->in(__DIR__); return $config; From c8af84e09006acef793ebcdcbd291f37aaaaab6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 16 Sep 2024 18:26:03 +0200 Subject: [PATCH 3/9] chore: Remove two unused methods with incorrect code inside MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/Controller/PublicUtilsController.php | 14 -------------- lib/Controller/UtilsController.php | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/lib/Controller/PublicUtilsController.php b/lib/Controller/PublicUtilsController.php index 0550842c2..c7185874e 100644 --- a/lib/Controller/PublicUtilsController.php +++ b/lib/Controller/PublicUtilsController.php @@ -101,20 +101,6 @@ private function getShareNode() { return $share->getNode(); } - /** - * Delete user options - * - * @PublicPage - * @return DataResponse - */ - public function deleteOptionsValues(): DataResponse { - $keys = $this->config->getUserKeys(null, 'maps'); - foreach ($keys as $key) { - $this->config->deleteUserValue(null, 'maps', $key); - } - return new DataResponse(['done' => 1]); - } - /** * Save options values to the DB for current user * diff --git a/lib/Controller/UtilsController.php b/lib/Controller/UtilsController.php index 1afbfc427..335e557b6 100644 --- a/lib/Controller/UtilsController.php +++ b/lib/Controller/UtilsController.php @@ -46,20 +46,6 @@ public function __construct($AppName, $this->config = $config; } - /** - * Delete user options - * - * @NoAdminRequired - * @return DataResponse - */ - public function deleteOptionsValues(): DataResponse { - $keys = $this->config->getUserKeys($this->userId, 'maps'); - foreach ($keys as $key) { - $this->config->deleteUserValue($this->userId, 'maps', $key); - } - return new DataResponse(['done' => 1]); - } - /** * Save options values to the DB for current user * From b2331386b7d53ef4d0ff333aff7c7bb6d8289981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 16 Sep 2024 19:38:44 +0200 Subject: [PATCH 4/9] chore: fix the last psalm errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/Helper/ExifGeoData.php | 7 ++----- lib/Hooks/FileHooks.php | 10 +++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/Helper/ExifGeoData.php b/lib/Helper/ExifGeoData.php index d109762d4..21f23806c 100644 --- a/lib/Helper/ExifGeoData.php +++ b/lib/Helper/ExifGeoData.php @@ -96,17 +96,14 @@ class ExifGeoData extends \stdClass implements \JsonSerializable { protected $exif_data = null; /** - * @param string $path - * - * @return array|null * @throws PelInvalidArgumentException */ protected static function get_exif_data_array(string $path) : array { if (function_exists('exif_read_data')) { $data = @exif_read_data($path, null, true); - if ($data && isset($data['EXIF']) && isset($data['EXIF'][self::LATITUDE]) && isset($data['EXIF'][self::LONGITUDE])) { + if ($data && isset($data['EXIF']) && is_array($data['EXIF']) && isset($data['EXIF'][self::LATITUDE]) && isset($data['EXIF'][self::LONGITUDE])) { return $data['EXIF']; - } elseif ($data && isset($data['GPS']) && isset($data['GPS'][self::LATITUDE]) && isset($data['GPS'][self::LONGITUDE])) { + } elseif ($data && isset($data['GPS']) && is_array($data['GPS']) && isset($data['GPS'][self::LATITUDE]) && isset($data['GPS'][self::LONGITUDE])) { $d = $data['GPS']; if (!isset($d[self::TIMESTAMP]) && isset($data['EXIF'][self::TIMESTAMP])) { $d[self::TIMESTAMP] = $data['EXIF'][self::TIMESTAMP]; diff --git a/lib/Hooks/FileHooks.php b/lib/Hooks/FileHooks.php index 1a09fe306..a0e8c31b0 100644 --- a/lib/Hooks/FileHooks.php +++ b/lib/Hooks/FileHooks.php @@ -16,10 +16,10 @@ use OCA\Maps\Service\PhotofilesService; use OCA\Maps\Service\TracksService; use OCP\Files\FileInfo; +use OCP\Files\IHomeStorage; use OCP\Files\IRootFolder; use OCP\ILogger; use OCP\Lock\ILockingProvider; - use OCP\Share; use OCP\Util; @@ -179,12 +179,8 @@ private function getNodeForPath($path) { return $this->root->get($fullPath); } - /** - * Ugly Hack, find API way to check if file is added by user. - */ - private function isUserNode(\OCP\Files\Node $node) { - //return strpos($node->getStorage()->getId(), "home::", 0) === 0; - return $node->getStorage()->instanceOfStorage('\OC\Files\Storage\Home'); + private function isUserNode(\OCP\Files\Node $node): bool { + return $node->getStorage()->instanceOfStorage(IHomeStorage::class); } } From c16bb363d01f5e9272c151f62e80b1e80f83b178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 16 Sep 2024 19:39:17 +0200 Subject: [PATCH 5/9] chore: composer run cs:fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/Controller/FavoritesController.php | 2 +- lib/Controller/PublicFavoritePageController.php | 1 - lib/Controller/PublicFavoritesController.php | 1 - lib/Controller/PublicPageController.php | 1 - lib/Migration/InstallScan.php | 1 - lib/Service/FavoritesService.php | 2 +- lib/Service/TracksService.php | 1 - lib/Settings/AdminSettings.php | 2 -- 8 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/Controller/FavoritesController.php b/lib/Controller/FavoritesController.php index 09a1d1fdc..2d0b35925 100644 --- a/lib/Controller/FavoritesController.php +++ b/lib/Controller/FavoritesController.php @@ -21,8 +21,8 @@ use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; -use OCP\Files\NotFoundException; use OCP\Files\Folder; +use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IDateTimeZone; use OCP\IGroupManager; diff --git a/lib/Controller/PublicFavoritePageController.php b/lib/Controller/PublicFavoritePageController.php index af17d1b61..2b455656b 100644 --- a/lib/Controller/PublicFavoritePageController.php +++ b/lib/Controller/PublicFavoritePageController.php @@ -23,7 +23,6 @@ namespace OCA\Maps\Controller; -use OC; use OCA\Maps\DB\FavoriteShareMapper; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\MultipleObjectsReturnedException; diff --git a/lib/Controller/PublicFavoritesController.php b/lib/Controller/PublicFavoritesController.php index f86252620..45dd977cf 100644 --- a/lib/Controller/PublicFavoritesController.php +++ b/lib/Controller/PublicFavoritesController.php @@ -26,7 +26,6 @@ use OCP\IGroupManager; use OCP\IInitialStateService; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\ISession; diff --git a/lib/Controller/PublicPageController.php b/lib/Controller/PublicPageController.php index 055ca9d27..99a9e1cf4 100644 --- a/lib/Controller/PublicPageController.php +++ b/lib/Controller/PublicPageController.php @@ -11,7 +11,6 @@ namespace OCA\Maps\Controller; -use OC\InitialStateService; use OC\Security\CSP\ContentSecurityPolicy; use OCA\Files\Event\LoadSidebar; use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent; diff --git a/lib/Migration/InstallScan.php b/lib/Migration/InstallScan.php index 99128cdb9..40ac0fd28 100644 --- a/lib/Migration/InstallScan.php +++ b/lib/Migration/InstallScan.php @@ -27,7 +27,6 @@ use OCP\BackgroundJob\IJobList; use OCP\Encryption\IManager; use OCP\IConfig; -use OCP\IDBConnection; use OCP\IUser; use OCP\IUserManager; use OCP\Migration\IOutput; diff --git a/lib/Service/FavoritesService.php b/lib/Service/FavoritesService.php index 800896bd5..e2070d576 100644 --- a/lib/Service/FavoritesService.php +++ b/lib/Service/FavoritesService.php @@ -16,10 +16,10 @@ namespace OCA\Maps\Service; use OC\Archive\ZIP; -use OCP\Security\ISecureRandom; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\IL10N; +use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; class FavoritesService { diff --git a/lib/Service/TracksService.php b/lib/Service/TracksService.php index 96402ee16..4d8f495f3 100644 --- a/lib/Service/TracksService.php +++ b/lib/Service/TracksService.php @@ -24,7 +24,6 @@ use OCP\Files\Search\ISearchComparison; use OCP\IDBConnection; use OCP\IL10N; -use OCP\ILogger; use OCP\Share\IManager; use Psr\Log\LoggerInterface; diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 1ba7bc842..7baa601b9 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -5,8 +5,6 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IL10N; -use OCP\IRequest; -use OCP\IURLGenerator; use OCP\Settings\ISettings; class AdminSettings implements ISettings { From 85646242d3c95b7a496b811cc96b1a791fadd7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 19 Sep 2024 17:19:25 +0200 Subject: [PATCH 6/9] chore: Add psalm CI workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .github/workflows/psalm.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/psalm.yml diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml new file mode 100644 index 000000000..dd8148961 --- /dev/null +++ b/.github/workflows/psalm.yml @@ -0,0 +1,41 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: Static analysis + +on: pull_request + +concurrency: + group: psalm-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + static-analysis: + runs-on: ubuntu-latest + + name: static-psalm-analysis + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get php version + id: versions + uses: icewind1991/nextcloud-version-matrix@7d433286e92318f51ed0537b6c77374759e12f46 # v1.3.0 + + - name: Set up php${{ steps.versions.outputs.php-available }} + uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2 + with: + php-version: ${{ steps.versions.outputs.php-available }} + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + run: composer i + + - name: Run coding standards check + run: composer run psalm From 4136a6d602aaa70c4637959d50f93490ef83e10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 19 Sep 2024 17:23:56 +0200 Subject: [PATCH 7/9] chore: Ignore stubs in linter composer script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0fa3289c7..acd80ed72 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "scripts": { "cs:fix": "php-cs-fixer fix", "cs:check": "php-cs-fixer fix --dry-run --diff", - "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './tests/stubs/*' -print0 | xargs -0 -n1 php -l", "psalm": "psalm.phar --threads=1", "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", "psalm:clear": "psalm.phar --clear-cache && psalm.phar --clear-global-cache", From bf781ba8836d2e945e8769394b7b5df0bdc6c537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 19 Sep 2024 17:41:24 +0200 Subject: [PATCH 8/9] fix: Remove references to getLogger and ILogger in the tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- .../Unit/Controller/PublicFavoritePageControllerTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Controller/PublicFavoritePageControllerTest.php b/tests/Unit/Controller/PublicFavoritePageControllerTest.php index fa9871352..74846c047 100644 --- a/tests/Unit/Controller/PublicFavoritePageControllerTest.php +++ b/tests/Unit/Controller/PublicFavoritePageControllerTest.php @@ -33,6 +33,7 @@ use OCP\AppFramework\IAppContainer; use OCP\IServerContainer; use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; class PublicFavoritePageControllerTest extends TestCase { /* @var PublicFavoritePageController */ @@ -54,7 +55,7 @@ class PublicFavoritePageControllerTest extends TestCase { protected function setUp(): void { // Begin transaction - $db = OC::$server->query(\OCP\IDBConnection::class); + $db = \OCP\Server::get(\OCP\IDBConnection::class); $db->beginTransaction(); $this->app = new Application(); @@ -62,10 +63,10 @@ protected function setUp(): void { $this->container = $this->app->getContainer(); $container = $this->container; - $appName = $container->query('AppName'); + $appName = $container->query('appName'); $this->favoritesService = new FavoritesService( - $container->query(IServerContainer::class)->getLogger(), + $container->query(IServerContainer::class)->get(LoggerInterface::class), $container->query(IServerContainer::class)->getL10N($appName), $container->query(IServerContainer::class)->getSecureRandom(), $container->query(\OCP\IDBConnection::class) @@ -87,7 +88,7 @@ protected function setUp(): void { $requestMock, $sessionMock, $this->config, - $container->query(\OCP\ILogger::class), + $container->query(LoggerInterface::class), $this->favoriteShareMapper ); } From 64f338689c4a4d3c487edb052778b9097b116a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 19 Sep 2024 17:57:02 +0200 Subject: [PATCH 9/9] chore: Migrate from ILogger to LoggerInterface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/AppInfo/Application.php | 1 - lib/Controller/ContactsController.php | 5 ----- lib/Controller/DevicesApiController.php | 9 --------- lib/Controller/DevicesController.php | 6 ------ lib/Controller/FavoritesApiController.php | 4 ---- lib/Controller/FavoritesController.php | 4 ---- lib/Controller/PhotosController.php | 5 ----- lib/Controller/PublicFavoritePageController.php | 4 ---- lib/Controller/PublicFavoritesController.php | 2 -- lib/Controller/PublicTracksController.php | 4 ---- lib/Controller/RoutingController.php | 8 -------- lib/Controller/TracksController.php | 9 --------- lib/Hooks/FileHooks.php | 6 +----- lib/Listener/CardCreatedListener.php | 7 +------ lib/Listener/CardDeletedListener.php | 7 +------ lib/Listener/CardUpdatedListener.php | 7 +------ lib/Service/AddressService.php | 13 ++++++++----- lib/Service/GeophotoService.php | 7 +------ lib/Service/PhotofilesService.php | 8 +++----- tests/Unit/Controller/ContactsControllerTest.php | 5 ++--- tests/Unit/Controller/DevicesApiControllerTest.php | 2 -- tests/Unit/Controller/DevicesControllerTest.php | 2 -- .../Unit/Controller/FavoritesApiControllerTest.php | 2 -- tests/Unit/Controller/FavoritesControllerTest.php | 2 -- tests/Unit/Controller/PhotosControllerTest.php | 4 +--- .../Controller/PublicFavoritePageControllerTest.php | 1 - .../Controller/PublicFavoritesApiControllerTest.php | 2 +- tests/Unit/Controller/TracksControllerTest.php | 4 +--- 28 files changed, 21 insertions(+), 119 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index bfa00e614..385160a11 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -76,7 +76,6 @@ public function boot(IBootContext $context): void { $c->query(IServerContainer::class)->getRootFolder(), \OCP\Server::get(PhotofilesService::class), \OCP\Server::get(TracksService::class), - $c->query(IServerContainer::class)->getLogger(), $c->query('AppName'), $c->query(IServerContainer::class)->getLockingProvider() ); diff --git a/lib/Controller/ContactsController.php b/lib/Controller/ContactsController.php index 0062736d1..58225c052 100644 --- a/lib/Controller/ContactsController.php +++ b/lib/Controller/ContactsController.php @@ -24,7 +24,6 @@ use OCP\Files\NotFoundException; use OCP\IAvatarManager; use OCP\IDBConnection; -use OCP\ILogger; use OCP\IRequest; use OCP\IURLGenerator; use Sabre\VObject\Property\Text; @@ -32,7 +31,6 @@ class ContactsController extends Controller { private $userId; - private $logger; private $contactsManager; private $addressService; private $dbconnection; @@ -45,7 +43,6 @@ class ContactsController extends Controller { /** * @param $AppName - * @param ILogger $logger * @param IRequest $request * @param IDBConnection $dbconnection * @param IManager $contactsManager @@ -57,7 +54,6 @@ class ContactsController extends Controller { */ public function __construct( $AppName, - ILogger $logger, IRequest $request, IDBConnection $dbconnection, IManager $contactsManager, @@ -68,7 +64,6 @@ public function __construct( IRootFolder $root, IURLGenerator $urlGenerator) { parent::__construct($AppName, $request); - $this->logger = $logger; $this->userId = $UserId; $this->avatarManager = $avatarManager; $this->contactsManager = $contactsManager; diff --git a/lib/Controller/DevicesApiController.php b/lib/Controller/DevicesApiController.php index 6c122abee..a14d3c087 100644 --- a/lib/Controller/DevicesApiController.php +++ b/lib/Controller/DevicesApiController.php @@ -12,22 +12,16 @@ namespace OCA\Maps\Controller; use OCA\Maps\Service\DevicesService; - use OCP\App\IAppManager; use OCP\AppFramework\ApiController; - use OCP\AppFramework\Http; - - use OCP\AppFramework\Http\DataResponse; use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserManager; - use OCP\Share\IManager; class DevicesApiController extends ApiController { @@ -43,7 +37,6 @@ class DevicesApiController extends ApiController { private $dbdblquotes; private $defaultDeviceId; private $l; - private $logger; private $devicesService; protected $appName; @@ -56,7 +49,6 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, DevicesService $devicesService, $UserId) { parent::__construct($AppName, $request, @@ -64,7 +56,6 @@ public function __construct($AppName, 'Authorization, Content-Type, Accept', 1728000); $this->devicesService = $devicesService; - $this->logger = $logger; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userId = $UserId; diff --git a/lib/Controller/DevicesController.php b/lib/Controller/DevicesController.php index fee5dcd9f..7e8cd7e2d 100644 --- a/lib/Controller/DevicesController.php +++ b/lib/Controller/DevicesController.php @@ -25,12 +25,9 @@ use OCP\IDateTimeZone; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; - use OCP\IUserManager; - use OCP\Share\IManager; //use function \OCA\Maps\Service\endswith; @@ -48,7 +45,6 @@ class DevicesController extends Controller { private $dbdblquotes; private $defaultDeviceId; private $l; - private $logger; private $devicesService; private $deviceShareMapper; private $dateTimeZone; @@ -64,7 +60,6 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, DevicesService $devicesService, DeviceShareMapper $deviceShareMapper, IDateTimeZone $dateTimeZone, @@ -74,7 +69,6 @@ public function __construct($AppName, $this->devicesService = $devicesService; $this->deviceShareMapper = $deviceShareMapper; $this->dateTimeZone = $dateTimeZone; - $this->logger = $logger; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userId = $UserId; diff --git a/lib/Controller/FavoritesApiController.php b/lib/Controller/FavoritesApiController.php index bd312d79d..c27b033a8 100644 --- a/lib/Controller/FavoritesApiController.php +++ b/lib/Controller/FavoritesApiController.php @@ -19,7 +19,6 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserManager; @@ -37,7 +36,6 @@ class FavoritesApiController extends ApiController { private $dbdblquotes; private $defaultDeviceId; private $l; - private $logger; private $favoritesService; protected $appName; @@ -50,7 +48,6 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, FavoritesService $favoritesService, $UserId) { parent::__construct($AppName, $request, @@ -58,7 +55,6 @@ public function __construct($AppName, 'Authorization, Content-Type, Accept', 1728000); $this->favoritesService = $favoritesService; - $this->logger = $logger; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userId = $UserId; diff --git a/lib/Controller/FavoritesController.php b/lib/Controller/FavoritesController.php index 2d0b35925..fb02a23ec 100644 --- a/lib/Controller/FavoritesController.php +++ b/lib/Controller/FavoritesController.php @@ -27,7 +27,6 @@ use OCP\IDateTimeZone; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserManager; @@ -44,7 +43,6 @@ class FavoritesController extends Controller { private IGroupManager $groupManager; private string $dbtype; private IL10N $l; - private ILogger $logger; private FavoritesService $favoritesService; private IDateTimeZone $dateTimeZone; private ?string $defaultFavoritsJSON; @@ -62,7 +60,6 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, FavoritesService $favoritesService, IDateTimeZone $dateTimeZone, FavoriteShareMapper $favoriteShareMapper, @@ -70,7 +67,6 @@ public function __construct($AppName, parent::__construct($AppName, $request); $this->favoritesService = $favoritesService; $this->dateTimeZone = $dateTimeZone; - $this->logger = $logger; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userId = $UserId; diff --git a/lib/Controller/PhotosController.php b/lib/Controller/PhotosController.php index e9c9d7f21..4e21b4a83 100644 --- a/lib/Controller/PhotosController.php +++ b/lib/Controller/PhotosController.php @@ -22,26 +22,21 @@ use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; - -use OCP\ILogger; use OCP\IRequest; class PhotosController extends Controller { private $userId; private $geophotoService; private $photofilesService; - private $logger; private $root; public function __construct($AppName, - ILogger $logger, IRequest $request, GeophotoService $GeophotoService, PhotofilesService $photofilesService, IRootFolder $root, $UserId) { parent::__construct($AppName, $request); - $this->logger = $logger; $this->userId = $UserId; $this->geophotoService = $GeophotoService; $this->photofilesService = $photofilesService; diff --git a/lib/Controller/PublicFavoritePageController.php b/lib/Controller/PublicFavoritePageController.php index 2b455656b..4d94c71d5 100644 --- a/lib/Controller/PublicFavoritePageController.php +++ b/lib/Controller/PublicFavoritePageController.php @@ -32,7 +32,6 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\AppFramework\PublicShareController; use OCP\IConfig; -use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\IUserManager; @@ -40,7 +39,6 @@ class PublicFavoritePageController extends PublicShareController { private $config; - private $logger; /* @var FavoriteShareMapper */ private $favoriteShareMapper; @@ -50,12 +48,10 @@ public function __construct( IRequest $request, ISession $session, IConfig $config, - ILogger $logger, FavoriteShareMapper $favoriteShareMapper ) { parent::__construct($appName, $request, $session); $this->config = $config; - $this->logger = $logger; $this->favoriteShareMapper = $favoriteShareMapper; } diff --git a/lib/Controller/PublicFavoritesController.php b/lib/Controller/PublicFavoritesController.php index 45dd977cf..b5ee421fd 100644 --- a/lib/Controller/PublicFavoritesController.php +++ b/lib/Controller/PublicFavoritesController.php @@ -33,7 +33,6 @@ use OCP\IUserManager; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; -use Psr\Log\LoggerInterface; class PublicFavoritesController extends PublicPageController { @@ -61,7 +60,6 @@ public function __construct( IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - private LoggerInterface $logger, FavoritesService $favoritesService, IDateTimeZone $dateTimeZone, FavoriteShareMapper $favoriteShareMapper, diff --git a/lib/Controller/PublicTracksController.php b/lib/Controller/PublicTracksController.php index 7eedb5a31..0bde397d2 100644 --- a/lib/Controller/PublicTracksController.php +++ b/lib/Controller/PublicTracksController.php @@ -21,7 +21,6 @@ use OCP\IGroupManager; use OCP\IInitialStateService; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\ISession; @@ -39,7 +38,6 @@ class PublicTracksController extends PublicPageController { protected ShareManager $shareManager; protected IUserManager $userManager; protected IL10N $l; - protected ILogger $logger; protected TracksService $tracksService; protected $appName; protected IRootFolder $root; @@ -57,12 +55,10 @@ public function __construct( IServerContainer $serverContainer, protected IGroupManager $groupManager, IL10N $l, - ILogger $logger, TracksService $tracksService, IRootFolder $root) { parent::__construct($appName, $request, $session, $urlGenerator, $eventDispatcher, $config, $initialStateService, $shareManager, $userManager); $this->tracksService = $tracksService; - $this->logger = $logger; $this->l = $l; $this->root = $root; } diff --git a/lib/Controller/RoutingController.php b/lib/Controller/RoutingController.php index f511c382c..4b3666317 100644 --- a/lib/Controller/RoutingController.php +++ b/lib/Controller/RoutingController.php @@ -13,17 +13,12 @@ use OCA\Maps\Service\TracksService; use OCP\App\IAppManager; - use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; - - - use OCP\IConfig; use OCP\IDateTimeZone; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserManager; @@ -42,7 +37,6 @@ class RoutingController extends Controller { private $dbdblquotes; private $defaultDeviceId; private $l; - private $logger; private $dateTimeZone; private $tracksService; protected $appName; @@ -56,12 +50,10 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, IDateTimeZone $dateTimeZone, TracksService $tracksService, $UserId) { parent::__construct($AppName, $request); - $this->logger = $logger; $this->dateTimeZone = $dateTimeZone; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); diff --git a/lib/Controller/TracksController.php b/lib/Controller/TracksController.php index c268fcbf2..a576fd6bd 100644 --- a/lib/Controller/TracksController.php +++ b/lib/Controller/TracksController.php @@ -12,21 +12,15 @@ namespace OCA\Maps\Controller; use OCA\Maps\Service\TracksService; - use OCP\App\IAppManager; use OCP\AppFramework\Controller; - - - use OCP\AppFramework\Http\DataResponse; use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; -use OCP\ILogger; use OCP\IRequest; use OCP\IServerContainer; use OCP\IUserManager; - use OCP\Share\IManager; use function OCA\Maps\Helper\remove_utf8_bom; @@ -43,7 +37,6 @@ class TracksController extends Controller { private $dbtype; private $dbdblquotes; private $l; - private $logger; private $tracksService; protected $appName; @@ -56,12 +49,10 @@ public function __construct($AppName, IUserManager $userManager, IGroupManager $groupManager, IL10N $l, - ILogger $logger, TracksService $tracksService, $UserId) { parent::__construct($AppName, $request); $this->tracksService = $tracksService; - $this->logger = $logger; $this->appName = $AppName; $this->appVersion = $config->getAppValue('maps', 'installed_version'); $this->userId = $UserId; diff --git a/lib/Hooks/FileHooks.php b/lib/Hooks/FileHooks.php index a0e8c31b0..53d5ef81b 100644 --- a/lib/Hooks/FileHooks.php +++ b/lib/Hooks/FileHooks.php @@ -18,7 +18,6 @@ use OCP\Files\FileInfo; use OCP\Files\IHomeStorage; use OCP\Files\IRootFolder; -use OCP\ILogger; use OCP\Lock\ILockingProvider; use OCP\Share; use OCP\Util; @@ -31,17 +30,14 @@ class FileHooks { private $photofilesService; private $tracksService; - private $logger; - private $root; private ILockingProvider $lockingProvider; public function __construct(IRootFolder $root, PhotofilesService $photofilesService, TracksService $tracksService, - ILogger $logger, $appName, ILockingProvider $lockingProvider) { + $appName, ILockingProvider $lockingProvider) { $this->photofilesService = $photofilesService; $this->tracksService = $tracksService; - $this->logger = $logger; $this->root = $root; $this->lockingProvider = $lockingProvider; } diff --git a/lib/Listener/CardCreatedListener.php b/lib/Listener/CardCreatedListener.php index f14787c39..5c2e890b5 100644 --- a/lib/Listener/CardCreatedListener.php +++ b/lib/Listener/CardCreatedListener.php @@ -27,7 +27,6 @@ use OCA\Maps\Service\AddressService; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\ILogger; /** @template-implements IEventListener */ class CardCreatedListener implements IEventListener { @@ -35,14 +34,10 @@ class CardCreatedListener implements IEventListener { /** @var AddressService */ private $addressService; - /** @var ILogger */ - private $logger; - public function __construct( AddressService $addressService, - ILogger $logger) { + ) { $this->addressService = $addressService; - $this->logger = $logger; } public function handle(Event $event): void { diff --git a/lib/Listener/CardDeletedListener.php b/lib/Listener/CardDeletedListener.php index 2c377bcfb..1eaefef10 100644 --- a/lib/Listener/CardDeletedListener.php +++ b/lib/Listener/CardDeletedListener.php @@ -27,7 +27,6 @@ use OCA\Maps\Service\AddressService; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\ILogger; /** @template-implements IEventListener */ class CardDeletedListener implements IEventListener { @@ -35,14 +34,10 @@ class CardDeletedListener implements IEventListener { /** @var AddressService */ private $addressService; - /** @var ILogger */ - private $logger; - public function __construct( AddressService $addressService, - ILogger $logger) { + ) { $this->addressService = $addressService; - $this->logger = $logger; } public function handle(Event $event): void { diff --git a/lib/Listener/CardUpdatedListener.php b/lib/Listener/CardUpdatedListener.php index 05d2e13ba..6092b02f5 100644 --- a/lib/Listener/CardUpdatedListener.php +++ b/lib/Listener/CardUpdatedListener.php @@ -27,7 +27,6 @@ use OCA\Maps\Service\AddressService; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\ILogger; /** @template-implements IEventListener */ class CardUpdatedListener implements IEventListener { @@ -35,14 +34,10 @@ class CardUpdatedListener implements IEventListener { /** @var AddressService */ private $addressService; - /** @var ILogger */ - private $logger; - public function __construct( AddressService $addressService, - ILogger $logger) { + ) { $this->addressService = $addressService; - $this->logger = $logger; } public function handle(Event $event): void { diff --git a/lib/Service/AddressService.php b/lib/Service/AddressService.php index 3ba520922..dc3132a78 100644 --- a/lib/Service/AddressService.php +++ b/lib/Service/AddressService.php @@ -18,9 +18,9 @@ use OCP\Files\IAppData; use OCP\ICacheFactory; use OCP\IDBConnection; -use OCP\ILogger; use OCP\IMemcache; use OpenLocationCode\OpenLocationCode; +use Psr\Log\LoggerInterface; use Sabre\VObject\Reader; /** @@ -41,19 +41,22 @@ class AddressService { private $qb; private $dbconnection; - private $logger; private $jobList; private $appData; /** @var IMemcache */ private $memcache; - public function __construct(ICacheFactory $cacheFactory, ILogger $logger, IJobList $jobList, - IAppData $appData, IDBConnection $dbconnection) { + public function __construct( + ICacheFactory $cacheFactory, + private LoggerInterface $logger, + IJobList $jobList, + IAppData $appData, + IDBConnection $dbconnection, + ) { $this->dbconnection = $dbconnection; $this->qb = $dbconnection->getQueryBuilder(); $this->memcache = $cacheFactory->createLocal('maps'); - $this->logger = $logger; $this->jobList = $jobList; $this->appData = $appData; } diff --git a/lib/Service/GeophotoService.php b/lib/Service/GeophotoService.php index 41ca799b2..10207cfe6 100644 --- a/lib/Service/GeophotoService.php +++ b/lib/Service/GeophotoService.php @@ -27,9 +27,6 @@ use OCP\Files\Search\ISearchComparison; use OCP\ICacheFactory; use OCP\IL10N; -use OCP\ILogger; - - use OCP\IPreview; class GeophotoService { @@ -37,7 +34,6 @@ class GeophotoService { private $l10n; private $root; private $photoMapper; - private $logger; private $preview; private $tracksService; private $timeorderedPointSets; @@ -48,7 +44,7 @@ class GeophotoService { private \OCP\ICache $timeOrderedPointSetsCache; private \OCP\ICache $backgroundJobCache; - public function __construct(ILogger $logger, + public function __construct( IRootFolder $root, IL10N $l10n, GeophotoMapper $photoMapper, @@ -60,7 +56,6 @@ public function __construct(ILogger $logger, $this->root = $root; $this->l10n = $l10n; $this->photoMapper = $photoMapper; - $this->logger = $logger; $this->preview = $preview; $this->tracksService = $tracksService; $this->timeorderedPointSets = null; diff --git a/lib/Service/PhotofilesService.php b/lib/Service/PhotofilesService.php index 621a9c3f4..461b0c3ca 100644 --- a/lib/Service/PhotofilesService.php +++ b/lib/Service/PhotofilesService.php @@ -25,11 +25,10 @@ use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\Node; - use OCP\ICacheFactory; use OCP\IL10N; -use OCP\ILogger; use OCP\Share\IManager; +use Psr\Log\LoggerInterface; require_once __DIR__ . '/../../vendor/autoload.php'; use lsolesen\pel\PelDataWindow; @@ -49,13 +48,13 @@ class PhotofilesService { private $root; private $photoMapper; private $shareManager; - private $logger; private $jobList; private ICacheFactory $cacheFactory; private \OCP\ICache $photosCache; private \OCP\ICache $backgroundJobCache; - public function __construct(ILogger $logger, + public function __construct( + private LoggerInterface $logger, ICacheFactory $cacheFactory, IRootFolder $root, IL10N $l10n, @@ -66,7 +65,6 @@ public function __construct(ILogger $logger, $this->l10n = $l10n; $this->photoMapper = $photoMapper; $this->shareManager = $shareManager; - $this->logger = $logger; $this->jobList = $jobList; $this->cacheFactory = $cacheFactory; $this->photosCache = $this->cacheFactory->createDistributed('maps:photos'); diff --git a/tests/Unit/Controller/ContactsControllerTest.php b/tests/Unit/Controller/ContactsControllerTest.php index d06438c36..a44a39058 100644 --- a/tests/Unit/Controller/ContactsControllerTest.php +++ b/tests/Unit/Controller/ContactsControllerTest.php @@ -18,6 +18,7 @@ use OCA\Maps\AppInfo\Application; use OCA\Maps\Service\AddressService; use OCP\IServerContainer; +use Psr\Log\LoggerInterface; class ContactsControllerTest extends \PHPUnit\Framework\TestCase { private $appName; @@ -97,7 +98,7 @@ protected function setUp(): void { $this->addressService = new AddressService( $c->query(IServerContainer::class)->getMemCacheFactory(), - $c->query(IServerContainer::class)->getLogger(), + $c->query(IServerContainer::class)->get(LoggerInterface::class), $c->query(IServerContainer::class)->getJobList(), $this->appData, $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class) @@ -122,7 +123,6 @@ protected function setUp(): void { $this->contactsController = new ContactsController( $this->appName, - $c->query(IServerContainer::class)->getLogger(), $this->request, $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class), $this->contactsManager, @@ -138,7 +138,6 @@ protected function setUp(): void { $this->contactsController2 = new ContactsController( $this->appName, - $c->query(IServerContainer::class)->getLogger(), $this->request, $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class), $this->contactsManager, diff --git a/tests/Unit/Controller/DevicesApiControllerTest.php b/tests/Unit/Controller/DevicesApiControllerTest.php index 519011359..012ddcc43 100644 --- a/tests/Unit/Controller/DevicesApiControllerTest.php +++ b/tests/Unit/Controller/DevicesApiControllerTest.php @@ -87,7 +87,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(DevicesService::class), 'test' ); @@ -102,7 +101,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(DevicesService::class), 'test2' ); diff --git a/tests/Unit/Controller/DevicesControllerTest.php b/tests/Unit/Controller/DevicesControllerTest.php index 15e120f85..2a3d1a79f 100644 --- a/tests/Unit/Controller/DevicesControllerTest.php +++ b/tests/Unit/Controller/DevicesControllerTest.php @@ -89,7 +89,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(DevicesService::class), $c->query(DeviceShareMapper::class), $c->query(IServerContainer::class)->getDateTimeZone(), @@ -107,7 +106,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(DevicesService::class), $c->query(DeviceShareMapper::class), $c->query(IServerContainer::class)->getDateTimeZone(), diff --git a/tests/Unit/Controller/FavoritesApiControllerTest.php b/tests/Unit/Controller/FavoritesApiControllerTest.php index 1018874a7..bcdfc21f0 100644 --- a/tests/Unit/Controller/FavoritesApiControllerTest.php +++ b/tests/Unit/Controller/FavoritesApiControllerTest.php @@ -87,7 +87,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(FavoritesService::class), 'test' ); @@ -102,7 +101,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(FavoritesService::class), 'test2' ); diff --git a/tests/Unit/Controller/FavoritesControllerTest.php b/tests/Unit/Controller/FavoritesControllerTest.php index 73f13044c..d24419858 100644 --- a/tests/Unit/Controller/FavoritesControllerTest.php +++ b/tests/Unit/Controller/FavoritesControllerTest.php @@ -97,7 +97,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(FavoritesService::class), $c->query(IServerContainer::class)->getDateTimeZone(), $c->query(FavoriteShareMapper::class), @@ -114,7 +113,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(FavoritesService::class), $c->query(IServerContainer::class)->getDateTimeZone(), $c->query(FavoriteShareMapper::class), diff --git a/tests/Unit/Controller/PhotosControllerTest.php b/tests/Unit/Controller/PhotosControllerTest.php index 1e46d9514..23e00a67a 100644 --- a/tests/Unit/Controller/PhotosControllerTest.php +++ b/tests/Unit/Controller/PhotosControllerTest.php @@ -86,7 +86,7 @@ protected function setUp(): void { $this->GeoPhotosService = $c->query(GeoPhotoService::class); $this->photoFileService = new PhotoFilesService( - $c->query(IServerContainer::class)->getLogger(), + $c->query(IServerContainer::class)->get(\Psr\Log\LoggerInterface::class), $c->query(IServerContainer::class)->getMemCacheFactory(), $this->rootFolder, $c->query(IServerContainer::class)->getL10N($c->query('AppName')), @@ -97,7 +97,6 @@ protected function setUp(): void { $this->photosController = new PhotosController( $this->appName, - $c->query(IServerContainer::class)->getLogger(), $this->request, $this->GeoPhotosService, $this->photoFileService, @@ -107,7 +106,6 @@ protected function setUp(): void { $this->photosController2 = new PhotosController( $this->appName, - $c->query(IServerContainer::class)->getLogger(), $this->request, $c->query(GeoPhotoService::class), $this->photoFileService, diff --git a/tests/Unit/Controller/PublicFavoritePageControllerTest.php b/tests/Unit/Controller/PublicFavoritePageControllerTest.php index 74846c047..cf1f00325 100644 --- a/tests/Unit/Controller/PublicFavoritePageControllerTest.php +++ b/tests/Unit/Controller/PublicFavoritePageControllerTest.php @@ -88,7 +88,6 @@ protected function setUp(): void { $requestMock, $sessionMock, $this->config, - $container->query(LoggerInterface::class), $this->favoriteShareMapper ); } diff --git a/tests/Unit/Controller/PublicFavoritesApiControllerTest.php b/tests/Unit/Controller/PublicFavoritesApiControllerTest.php index f9290af33..0ef83d714 100644 --- a/tests/Unit/Controller/PublicFavoritesApiControllerTest.php +++ b/tests/Unit/Controller/PublicFavoritesApiControllerTest.php @@ -59,7 +59,7 @@ protected function setUp(): void { $this->config = $container->query(IServerContainer::class)->getConfig(); $this->favoritesService = new FavoritesService( - $container->query(IServerContainer::class)->getLogger(), + $container->query(IServerContainer::class)->get(\Psr\Log\LoggerInterface::class), $container->query(IServerContainer::class)->getL10N($appName), $container->query(IServerContainer::class)->getSecureRandom(), $container->query(\OCP\IDBConnection::class) diff --git a/tests/Unit/Controller/TracksControllerTest.php b/tests/Unit/Controller/TracksControllerTest.php index 447e73272..3c9e7e1e2 100644 --- a/tests/Unit/Controller/TracksControllerTest.php +++ b/tests/Unit/Controller/TracksControllerTest.php @@ -81,7 +81,7 @@ protected function setUp(): void { $this->rootFolder = $c->query(IServerContainer::class)->getRootFolder(); $this->tracksService = new TracksService( - $c->query(IServerContainer::class)->getLogger(), + $c->query(IServerContainer::class)->get(\Psr\Log\LoggerInterface::class), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), $this->rootFolder, $c->query(IServerContainer::class)->getShareManager(), @@ -98,7 +98,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(TracksService::class), 'test', ); @@ -113,7 +112,6 @@ protected function setUp(): void { $c->getServer()->getUserManager(), $c->getServer()->getGroupManager(), $c->query(IServerContainer::class)->getL10N($c->query('AppName')), - $c->query(IServerContainer::class)->getLogger(), $c->query(TracksService::class), 'test2', );