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

Support Laravel 11 #22

Merged
merged 4 commits into from
Mar 29, 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
8 changes: 5 additions & 3 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1]
laravel: [10.*]
php: [8.3]
laravel: [10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [10.*]
php: [8.1, 8.2, 8.3]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
],
"require": {
"php": "^8.1",
"justbetter/odata-client": "^1.2",
"laravel/framework": "^10.0"
"justbetter/odata-client": "^1.3",
"laravel/framework": "^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.6",
"nunomaduro/larastan": "^2.5",
"orchestra/testbench": "^8.11",
"larastan/larastan": "^2.9",
"laravel/pint": "^1.15",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./vendor/larastan/larastan/extension.neon

parameters:
paths:
Expand Down
26 changes: 11 additions & 15 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Tests">
<directory>./tests/*</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Tests">
<directory>./tests/*</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
8 changes: 4 additions & 4 deletions src/OData/BaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ abstract class BaseResource implements Arrayable, ArrayAccess

public string $endpoint;

final public function __construct(string $connection = null, string $endpoint = null)
final public function __construct(?string $connection = null, ?string $endpoint = null)
{
$this->connection ??= $connection ?? config('dynamics.connection');
$this->endpoint ??= $endpoint ?? config('dynamics.resources.'.static::class,
Str::afterLast(static::class, '\\'));
}

public static function new(string $connection = null, string $endpoint = null): static
public static function new(?string $connection = null, ?string $endpoint = null): static
{
return new static($connection, $endpoint);
}

public static function query(string $connection = null, string $endpoint = null): QueryBuilder
public static function query(?string $connection = null, ?string $endpoint = null): QueryBuilder
{
return static::new($connection, $endpoint)->newQuery();
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public function etag(bool $force = false): string
: $this->data['odata.etag'];
}

public function client(string $etag = null): ODataClient
public function client(?string $etag = null): ODataClient
{
/** @var ClientFactoryContract $factory */
$factory = app(ClientFactoryContract::class, ['connection' => $this->connection]);
Expand Down
2 changes: 1 addition & 1 deletion src/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function firstOrCreate(array $attributes = [], array $values = []): BaseR
return $this->newResourceInstance()->create($data);
}

public function lazy(int $pageSize = null): LazyCollection
public function lazy(?int $pageSize = null): LazyCollection
{
return LazyCollection::make(function () use ($pageSize): Generator {
$pageSize ??= (int) config('dynamics.connections.'.$this->connection.'.page_size');
Expand Down