Skip to content

Commit

Permalink
Updated PHP and composer packages
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jun 17, 2024
1 parent bd72283 commit c016c79
Show file tree
Hide file tree
Showing 14 changed files with 1,957 additions and 1,174 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1']
php: ['8.3']
name: Validate composer (${{ matrix.php}})
steps:
- name: Checkout
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1']
php: ['8.3']
name: PHP coding standards (${{ matrix.php }})
steps:
- name: Checkout
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1']
php: ['8.3']
name: PHP code analysis (${{ matrix.php }})
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": "^8.1",
"php": "^8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"deskpro/deskpro-api-client-php": "^2.1",
Expand Down
3,052 changes: 1,921 additions & 1,131 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker-compose.server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ networks:

services:
phpfpm:
image: itkdev/php8.1-fpm:alpine
image: itkdev/php8.3-fpm:alpine
restart: unless-stopped
networks:
- app
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
#- ENCRYPT=1 # Uncomment to enable database encryption.

phpfpm:
image: itkdev/php8.1-fpm:latest
image: itkdev/php8.3-fpm:latest
networks:
- app
extra_hosts:
Expand Down
4 changes: 2 additions & 2 deletions src/Command/GetOrganized/DocumentsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ private function list()
}
}
$io->definitionList(...$list);
// call_user_func_array([$io, 'definitionList'], $list);
// call_user_func_array([$io, 'definitionList'], $list);
}
// $this->writeTable($documents, true);
// $this->writeTable($documents, true);

return self::SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/User/RolesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::SUCCESS;
}

private function listRoles(SymfonyStyle $io, User $user, string $header = null)
private function listRoles(SymfonyStyle $io, User $user, ?string $header = null)
{
if (null !== $header) {
$io->writeln($header);
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Archiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function setLastRunAt(?\DateTimeInterface $lastRunAt): self
return $this;
}

public function getConfigurationValue(string $key = null, $default = null)
public function getConfigurationValue(?string $key = null, $default = null)
{
$configuration = Yaml::parse($this->getConfiguration());

Expand Down
2 changes: 1 addition & 1 deletion src/Form/YamlEditorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getParent()
private function validateData($input, FormInterface $form)
{
try {
$data = Yaml::parse($input, YAML::PARSE_OBJECT_FOR_MAP);
$data = Yaml::parse($input, Yaml::PARSE_OBJECT_FOR_MAP);
if (!empty($this->options['schema'])) {
// @fixme
// $schemaContent = file_get_contents($this->options['schema']);
Expand Down
14 changes: 7 additions & 7 deletions src/GetOrganized/ArchiveHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function log($level, $message, array $context = [])
$this->logger->log($level, $message, $context);
}

private function archiveResponses(string $hearingItemId = null)
private function archiveResponses(?string $hearingItemId = null)
{
if (null !== $hearingItemId) {
$this->info(sprintf('Getting hearing %s', $hearingItemId));
Expand Down Expand Up @@ -167,16 +167,16 @@ static function (Item $file) use ($pattern) {
}
} catch (\Throwable $t) {
$this->logException($t, [
'shareFileHearing' => $shareFileHearing,
'getOrganizedHearing' => $getOrganizedHearing,
'sourceFile' => $sourceFile,
]);
'shareFileHearing' => $shareFileHearing,
'getOrganizedHearing' => $getOrganizedHearing,
'sourceFile' => $sourceFile,
]);
}
}
}
}

private function archiveOverviews(string $hearingItemId = null)
private function archiveOverviews(?string $hearingItemId = null)
{
$overviews = $this->archiver->getConfigurationValue('[getorganized][overview][items]');
if (empty($overviews)) {
Expand Down Expand Up @@ -288,7 +288,7 @@ private function archiveOverviews(string $hearingItemId = null)
}
}

private function archiveDocument(Item $sourceFile, CaseEntity $getOrganizedHearing, string $title = null, array $options = [])
private function archiveDocument(Item $sourceFile, CaseEntity $getOrganizedHearing, ?string $title = null, array $options = [])
{
$metadata = [];

Expand Down
8 changes: 4 additions & 4 deletions src/GetOrganized/GetOrganizedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function linkDocument(GetOrganizedCase $case, GetOrganizedDocument $docum
return $this->documentHelper->created($case, $document, $item, $metadata, $archiver);
}

public function createDocument(string $contents, CaseEntity $case, Item $item, array $metadata, array $options = []): Document
public function createDocument(string $contents, GetOrganizedCase $case, Item $item, array $metadata, array $options = []): Document
{
$path = $this->writeFile($contents, $item);
$metadata = $this->buildMetadata($metadata, $options['item_metadata'] ?? []);
Expand All @@ -93,7 +93,7 @@ public function createDocument(string $contents, CaseEntity $case, Item $item, a
return $this->documentHelper->created($case, new GetOrganizedDocument($response), $item, $metadata, $this->archiver);
}

public function updateDocument(Document $document, string $contents, CaseEntity $case, Item $item, array $metadata, array $options = []): Document
public function updateDocument(Document $document, string $contents, GetOrganizedCase $case, Item $item, array $metadata, array $options = []): Document
{
$path = $this->writeFile($contents, $item);
$metadata = $this->buildMetadata($metadata, $options['item_metadata'] ?? []);
Expand Down Expand Up @@ -169,11 +169,11 @@ public function getCases(array $criteria = [])
$result = $this->getOrganizedCases()->FindCases($criteria);

return array_map(static function (array $data) {
return new CaseEntity($data);
return new GetOrganizedCase($data);
}, $result);
}

public function getCaseById(string $id): ?CaseEntity
public function getCaseById(string $id): ?GetOrganizedCase
{
$result = $this->getCases([
'CaseIdFilter' => $id,
Expand Down
8 changes: 4 additions & 4 deletions src/Overview/HearingOverviewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
EntityManagerInterface $entityManager,
MailerInterface $mailer,
Filesystem $filesystem,
LoggerInterface $logger = null,
?LoggerInterface $logger,
array $options
) {
$this->deskproService = $deskproService;
Expand All @@ -67,7 +67,7 @@ public function __construct(
$this->options = $resolver->resolve($options);
}

public function process(array $hearingsIds = null)
public function process(?array $hearingsIds = null)
{
if (null === $this->getArchiver()) {
throw new \RuntimeException('No archiver');
Expand Down Expand Up @@ -233,7 +233,7 @@ public function log($level, $message, array $context = [])
}
}

private function getHearings(array $hearingIds = null)
private function getHearings(?array $hearingIds = null)
{
$this->logger->info('Getting all hearings');
$config = $this->archiver->getConfigurationValue('hearings');
Expand Down Expand Up @@ -280,7 +280,7 @@ private function getHearings(array $hearingIds = null)
return $hearings;
}

private function getFinishedHearings(array $hearingIds = null)
private function getFinishedHearings(?array $hearingIds = null)
{
$hearings = $this->getHearings($hearingIds);

Expand Down
11 changes: 3 additions & 8 deletions src/Pdf/PdfHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function process()
}
}

public function run($hearingId, array $metadata = null)
public function run($hearingId, ?array $metadata = null)
{
if (null === $this->getArchiver()) {
throw new \RuntimeException('No archiver');
Expand All @@ -112,7 +112,7 @@ public function run($hearingId, array $metadata = null)
return $result;
}

public function getData($hearingId, array $metadata = null)
public function getData($hearingId, ?array $metadata = null)
{
if (null === $this->getArchiver()) {
throw new \RuntimeException('No archiver');
Expand Down Expand Up @@ -540,11 +540,6 @@ private function isOrganizationResponse($response)
return false;
}

private function isPrivateResponse($response)
{
return !$this->isOrganizationResponse($response);
}

private function generateFrontPage(array $data)
{
$template = 'pdf/frontpage.html.twig';
Expand Down Expand Up @@ -587,7 +582,7 @@ private function logException(\Throwable $t, array $context = [])
}
}

private function getHearings(array $hearingIds = null)
private function getHearings(?array $hearingIds = null)
{
$this->logger->info('Getting all hearings');
$config = $this->archiver->getConfigurationValue('hearings');
Expand Down
16 changes: 7 additions & 9 deletions src/ShareFile/ShareFileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function getUpdatedOverviewFiles(\DateTimeInterface $changedAfter)
}

/**
* @param mixed $hearingItemId
*
* @return Item[]
*/
public function getHearingOverviewFiles($hearingItemId)
Expand All @@ -93,7 +91,7 @@ public function getHearingOverviewFiles($hearingItemId)
/**
* @return Item[]
*/
public function getHearings(\DateTimeInterface $changedAfter = null)
public function getHearings(?\DateTimeInterface $changedAfter = null)
{
$itemId = $this->configuration['root_id'];
$folders = $this->getFolders($itemId, $changedAfter);
Expand Down Expand Up @@ -143,7 +141,7 @@ public function getHearing($itemId)
/**
* @return Item[]
*/
public function getResponses(Item $hearing, \DateTimeInterface $changedAfter = null)
public function getResponses(Item $hearing, ?\DateTimeInterface $changedAfter = null)
{
$folders = $this->getFolders($hearing, $changedAfter);
$responses = array_filter($folders ?? [], function ($item) use ($changedAfter) {
Expand Down Expand Up @@ -180,7 +178,7 @@ public function getItem($item)
*
* @return array
*/
public function getMetadata($item, array $names = null)
public function getMetadata($item, ?array $names = null)
{
$itemId = $this->getItemId($item);
$metadata = $this->client()->getItemMetadataList($itemId);
Expand All @@ -206,7 +204,7 @@ public function getMetadata($item, array $names = null)
*
* @return array
*/
public function getMetadataValues($item, array $names = null)
public function getMetadataValues($item, ?array $names = null)
{
$metadata = $this->getMetadata($item, $names);

Expand Down Expand Up @@ -235,7 +233,7 @@ public function getMetadataValue($item, string $name)
return $metadata[$name] ?? null;
}

public function getFiles($item, \DateTimeInterface $changedAfter = null)
public function getFiles($item, ?\DateTimeInterface $changedAfter = null)
{
$itemId = $this->getItemId($item);
$children = $this->getChildren($itemId, self::SHAREFILE_FILE, $changedAfter);
Expand All @@ -247,7 +245,7 @@ public function getFiles($item, \DateTimeInterface $changedAfter = null)
return $this->construct(Item::class, $files);
}

public function getFolders($item, \DateTimeInterface $changedAfter = null)
public function getFolders($item, ?\DateTimeInterface $changedAfter = null)
{
$itemId = $this->getItemId($item);

Expand Down Expand Up @@ -348,7 +346,7 @@ private function getItemId($item)
return $item instanceof Item ? $item->id : $item;
}

private function getChildren(string $itemId, string $type, \DateTimeInterface $changedAfter = null)
private function getChildren(string $itemId, string $type, ?\DateTimeInterface $changedAfter = null)
{
$query = [
'$filter' => 'isof(\''.$type.'\')',
Expand Down

0 comments on commit c016c79

Please sign in to comment.