Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Laravel 11, drop support for PHP 8.1 #9

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2' ]
php: [ '8.2', '8.3' ]
composer-flags: [ '', '--prefer-lowest' ]

steps:
Expand Down
7 changes: 4 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
->setUsingCache(true)
->setRules([
'psr_autoloading' => true,
'@PSR12' => true,
'@PER-CS' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'blank_line_after_namespace' => true,
'braces_position' => true,
'single_space_around_construct' => true,
'control_structure_braces' => true,
'curly_braces_position' => true,
'control_structure_continuation_position' => true,
'declare_parentheses' => true,
'statement_indentation' => true,
'no_multiple_statements_per_line' => true,
'no_extra_blank_lines' => true,
'nullable_type_declaration' => ['syntax' => 'union'],
'class_definition' => true,
'declare_strict_types' => true,
'elseif' => true,
Expand All @@ -39,7 +40,6 @@
'no_closing_tag' => true,
'no_blank_lines_after_class_opening' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_whitespace_in_blank_line' => true,
Expand All @@ -50,6 +50,7 @@
'single_line_after_imports' => true,
'single_trait_insert_per_statement' => true,
'short_scalar_cast' => true,
'spaces_inside_parentheses' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'single_quote' => true,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ composer require petersons/d2l-client

## Requirements

* [PHP 8.1](https://www.php.net/releases/8_1_0.php) or greater
* [PHP 8.2](https://www.php.net/releases/8_2_0.php) or greater

## Usage example

Expand Down Expand Up @@ -78,7 +78,7 @@ Docker dependencies for local development:

0. Build the Docker image
```bash
dev/bin/docker-compose build --build-arg PHP_VERSION=8.1 php
dev/bin/docker-compose build --build-arg PHP_VERSION=8.2 php
```

0. Install library dependencies
Expand Down
19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-curl": "*",
"ext-simplexml": "*",
"illuminate/collections": "^9.0 || ^10.0",
"illuminate/contracts": "^9.0 || ^10.0",
"illuminate/support": "^9.0 || ^10.0",
"nesbot/carbon": "^2.67",
"symfony/http-client": "^5.4.21 || ^6.3"
"illuminate/collections": "^10.0 || ^11.0",
"illuminate/contracts": "^10.0 || ^11.0",
"illuminate/support": "^10.0 || ^11.0",
"nesbot/carbon": "^2.72 || ^3.0",
"symfony/http-client": "^6.4 || ^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.46",
"illuminate/container": "^9.0 || ^10.0",
"phpunit/phpunit": "^9.6.9",
"nikic/php-parser": "^4.15.5"
"friendsofphp/php-cs-fixer": "^3.52",
"illuminate/container": "^10.0 || ^11.0",
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions dev/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.2

FROM php:${PHP_VERSION}-cli-alpine
LABEL maintainer="Antonio Pauletich <[email protected]>"

ARG COMPOSER_VERSION=2.5.8
ARG XDEBUG_VERSION=3.2.1
ARG COMPOSER_VERSION=2.7.2
ARG XDEBUG_VERSION=3.3.1

ENV XDEBUG_START_WITH_REQUEST "no"

Expand Down
11 changes: 3 additions & 8 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,26 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
failOnSkipped="true"
failOnIncomplete="true"
failOnRisky="true"
failOnWarning="true"
convertDeprecationsToExceptions="true">
failOnWarning="true">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory suffix=".php">./src/Laravel/config</directory>
</exclude>
</coverage>
</source>
</phpunit>
3 changes: 1 addition & 2 deletions src/AuthenticatedUriFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
private string $appKey,
private string $lmsUserId,
private string $lmsUserKey
) {
}
) {}

public function createAuthenticatedUri(string $url, string $httpMethod): string
{
Expand Down
28 changes: 14 additions & 14 deletions src/Contracts/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function validateGuid(Guid $guid, string $orgDefinedId): bool;
/**
* @link https://docs.valence.desire2learn.com/res/dataExport.html#get--d2l-api-lp-(version)-dataExport-bds
* @throws ApiException
* @return Collection|DataSetReportInfo[]
* @return Collection<DataSetReportInfo>
*/
public function getBrightspaceDataExportList(): Collection;

Expand All @@ -117,7 +117,7 @@ public function getBrightspaceDataExportItems(int $page = 1, int $pageSize = 100
* @link https://docs.valence.desire2learn.com/res/dataExport.html#get--d2l-api-lp-(version)-dataExport-bds
* @throws ApiException
*/
public function findBrightspaceDataExportItemByName(string $name): ?BrightspaceDataSetReportInfo;
public function findBrightspaceDataExportItemByName(string $name): BrightspaceDataSetReportInfo|null;

/**
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-(quizId)
Expand All @@ -129,30 +129,30 @@ public function getQuizById(int $orgUnitId, int $quizId): Quiz;
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-
* @throws ApiException
*/
public function quizzesList(int $orgUnitId, ?string $bookmark = null): QuizListPage;
public function quizzesList(int $orgUnitId, string|null $bookmark = null): QuizListPage;

/**
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-
* @return Collection|Quiz[]
* @return Collection<Quiz>
*/
public function getQuizzesForAnOrganizationUnit(int $orgUnitId): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-(quizId)-questions-
* @throws ApiException
*/
public function quizQuestionsList(int $orgUnitId, int $quizId, ?string $bookmark = null): QuizQuestionListPage;
public function quizQuestionsList(int $orgUnitId, int $quizId, string|null $bookmark = null): QuizQuestionListPage;

/**
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-(quizId)-questions-
* @return Collection|QuizQuestion[]
* @return Collection<QuizQuestion>
*/
public function getQuizQuestionsForAQuiz(int $orgUnitId, int $quizId): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/quiz.html#get--d2l-api-le-(version)-(orgUnitId)-quizzes-(quizId)-questions-
* @throws ApiException
* @return Collection|OrganizationUnitUser[]
* @return Collection<OrganizationUnitUser>
*/
public function getEnrolledUsersForAnOrganizationUnit(int $orgUnitId): Collection;

Expand All @@ -171,28 +171,28 @@ public function getOrganizationInfo(): OrganizationInfo;
/**
* @link https://docs.valence.desire2learn.com/res/orgunit.html#get--d2l-api-lp-(version)-orgstructure-
* @throws ApiException
* @return Collection|OrgUnitProperties[]
* @return Collection<OrgUnitProperties>
*/
public function getOrganizationStructure(): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/orgunit.html#get--d2l-api-lp-(version)-orgstructure-(orgUnitId)-descendants-paged-
* @throws ApiException
* @return Collection|OrgUnit[]
* @return Collection<OrgUnit>
*/
public function getDescendentUnitsForAnOrganizationUnit(int $orgUnitId): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/grade.html#get--d2l-api-le-(version)-(orgUnitId)-grades-categories-
* @throws ApiException
* @return Collection|GradeObjectCategory[]
* @return Collection<GradeObjectCategory>
*/
public function getGradeCategoriesForAnOrganizationUnit(int $orgUnitId): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/dataExport.html#get--d2l-api-lp-(version)-dataExport-list
* @throws ApiException
* @return Collection|DataSetData[]
* @return Collection<DataSetData>
*/
public function getDataExportList(): Collection;

Expand All @@ -205,14 +205,14 @@ public function createDataExport(CreateExportJobData $createExportJobData): Expo
/**
* @link https://docs.valence.desire2learn.com/res/content.html#get--d2l-api-le-(version)-(orgUnitId)-content-root-
* @throws ApiException
* @return Collection|Module[]
* @return Collection<Module>
*/
public function getRootModulesForAnOrganizationUnit(int $orgUnitId): Collection;

/**
* @link https://docs.valence.desire2learn.com/res/content.html#get--d2l-api-le-(version)-(orgUnitId)-content-modules-(moduleId)-structure-
* @throws ApiException
* @return Collection|ContentObject[]
* @return Collection<ContentObject>
*/
public function getModuleStructureForAnOrganizationUnit(int $orgUnitId, int $moduleId): Collection;

Expand All @@ -226,7 +226,7 @@ public function updateContentTopicCompletion(ContentTopicCompletionUpdate $updat
* Retrieve all the sections for a provided org unit.
* @link https://docs.valence.desire2learn.com/res/enroll.html#get--d2l-api-lp-(version)-(orgUnitId)-sections-
* @throws ApiException
* @return Collection|Section[]
* @return Collection<Section>
*/
public function getSectionsForOrganizationUnit(int $orgUnitId): Collection;
}
3 changes: 1 addition & 2 deletions src/CourseUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ final class CourseUrlGenerator
public function __construct(
private string $d2lHost,
private string $d2lGuidLoginUri
) {
}
) {}

/**
* @throws UserOrgDefinedIdMissingException
Expand Down
35 changes: 17 additions & 18 deletions src/DTO/BrightspaceDataSet/BrightspaceDataSetReportInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public function __construct(
private string $name,
private string $description,
private bool $fullDataset,
private ?CarbonImmutable $createdDate = null,
private ?string $downloadLink = null,
private ?float $downloadSize = null,
private ?string $version = null,
private ?Collection $previousDataSets = null,
private ?CarbonImmutable $queuedForProcessingDate = null
) {
}
private CarbonImmutable|null $createdDate = null,
private string|null $downloadLink = null,
private float|null $downloadSize = null,
private string|null $version = null,
private Collection|null $previousDataSets = null,
private CarbonImmutable|null $queuedForProcessingDate = null
) {}

public function getPluginId(): string
{
Expand All @@ -47,35 +46,35 @@ public function isFullDataset(): bool
return $this->fullDataset;
}

public function getCreatedDate(): ?CarbonImmutable
public function getCreatedDate(): CarbonImmutable|null
{
return $this->createdDate;
}

public function getDownloadLink(): ?string
public function getDownloadLink(): string|null
{
return $this->downloadLink;
}

public function getDownloadSize(): ?float
public function getDownloadSize(): float|null
{
return $this->downloadSize;
}

public function getVersion(): ?string
public function getVersion(): string|null
{
return $this->version;
}

/**
* @return Collection|null|BrightspaceDataSetReportInfo[]
* @return Collection<BrightspaceDataSetReportInfo>|null
*/
public function getPreviousDataSets(): ?Collection
public function getPreviousDataSets(): Collection|null
{
return $this->previousDataSets;
}

public function getQueuedForProcessingDate(): ?CarbonImmutable
public function getQueuedForProcessingDate(): CarbonImmutable|null
{
return $this->queuedForProcessingDate;
}
Expand All @@ -87,12 +86,12 @@ public function toArray(): array
'Name' => $this->name,
'Description' => $this->description,
'FullDataSet' => $this->fullDataset,
'CreatedDate' => null !== $this->createdDate ? $this->createdDate->toDateTime() : null,
'CreatedDate' => $this->createdDate?->toDateTime(),
'DownloadLink' => $this->downloadLink,
'DownloadSize' => $this->downloadSize,
'Version' => $this->version,
'PreviousDataSets' => null !== $this->previousDataSets ? $this->previousDataSets->toArray() : null,
'QueuedForProcessingDate' => null !== $this->queuedForProcessingDate ? $this->queuedForProcessingDate->toDateTime() : null,
'PreviousDataSets' => $this->previousDataSets?->toArray(),
'QueuedForProcessingDate' => $this->queuedForProcessingDate?->toDateTime(),
];
}
}
Loading
Loading