Skip to content

Feature l11 #39

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

Merged
merged 5 commits into from
Feb 27, 2025
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/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
9 changes: 3 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ jobs:
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.2, 8.3 ]
laravel: [ 10.* ]
laravel: [ 11.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 10.*
testbench: 8.*

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

Expand All @@ -41,7 +38,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Set phpunit.xml
Expand All @@ -55,7 +52,7 @@ jobs:
ZAMMAD_OBJECT_REFERENCE_ERROR_IGNORE: true

- name: Store test reports
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Store report
retention-days: 1
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
}
],
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.8.1",
"illuminate/contracts": "^10.0",
"php": ">=8.2",
"guzzlehttp/guzzle": "^7.8",
"illuminate/contracts": "^11.0",
"spatie/laravel-package-tools": "^1.16",
"saloonphp/laravel-plugin": "^3.3",
"saloonphp/saloon": "^3.6"
"saloonphp/laravel-plugin": "^3.5",
"saloonphp/saloon": "^3.7"
},
"require-dev": {
"laravel/pint": "^1.13",
"nunomaduro/collision": "^7.10",
"nunomaduro/larastan": "^2.8",
"nunomaduro/collision": "^8.1",
"larastan/larastan": "^2.9",
"pestphp/pest": "^2.3",
"orchestra/testbench": "^8.20",
"orchestra/testbench": "^9.0",
"pestphp/pest-plugin-laravel": "^2.2",
"pestphp/pest-plugin-arch": "^2.6",
"pestphp/pest-plugin-arch": "^2.7",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/RequestClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct()
$this->ignoreReferenceErrorIngore = config('zammad.object_reference_error_ignore');
$this->objectHasReferenceError = config('zammad.objet_reference_error');

$this->connector = new ZammadConnector();
$this->connector = new ZammadConnector;
}

private function performRequest(Request $request): Response
Expand Down
3 changes: 1 addition & 2 deletions src/DTO/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public function __construct(
public int $size,
public string $name,
public string $type,
) {
}
) {}

public function url(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/DTO/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public function __construct(
public Collection $attachments,
public Carbon $updated_at,
public Carbon $created_at,
) {
}
) {}

public static function fake(
?int $id = null,
Expand Down
3 changes: 1 addition & 2 deletions src/DTO/ObjectAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function __construct(
public int $position,
public array $data_option,
public ?array $data_option_new,
) {
}
) {}

public static function fake(
?int $id = null,
Expand Down
3 changes: 1 addition & 2 deletions src/DTO/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function __construct(
public Carbon $updated_at,
public Carbon $created_at,
public ?array $expanded = null,
) {
}
) {}

public static function fake(
?int $id = null,
Expand Down
4 changes: 1 addition & 3 deletions src/Events/ZammadResponseLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ class ZammadResponseLog
use InteractsWithSockets;
use SerializesModels;

public function __construct(public Response $response)
{
}
public function __construct(public Response $response) {}
}
3 changes: 1 addition & 2 deletions src/Requests/AccessTokens/CreateAccessTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class CreateAccessTokenRequest extends Request implements HasBody

public function __construct(
protected array $payload
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/AccessTokens/DestroyAccessTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class DestroyAccessTokenRequest extends Request
public function __construct(
public int $id,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Attachment/GetAttachmentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
public int $ticketId,
public int $commentId,
public int $attachmentId,
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Comments/CreateCommentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class CreateCommentRequest extends Request implements HasBody

public function __construct(
protected array $payload
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Comments/DestroyCommentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class DestroyCommentRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Comments/GetCommentByTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class GetCommentByTicketRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Comments/GetCommentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class GetCommentRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class CreateObjectAttributeRequest extends Request implements HasBody

public function __construct(
protected array $payload
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class DestroyObjectAttributeRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/ObjectAttribute/GetObjectAttributeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class GetObjectAttributeRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class UpdateObjectAttributeRequest extends Request implements HasBody
public function __construct(
public int $id,
public array $payload
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Tickets/AllTicketsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class AllTicketsRequest extends Request
public function __construct(
public ?int $perPage = null,
public ?int $page = null,
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Tickets/CreateTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class CreateTicketRequest extends Request implements HasBody
public function __construct(
protected array $payload,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Tickets/DestroyTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class DestroyTicketRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Tickets/GetTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class GetTicketRequest extends Request
public function __construct(
public int $id,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Tickets/SearchTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public ?int $limit = null,
public ?int $perPage = null,
public ?int $page = null,
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/AllUsersRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class AllUsersRequest extends Request
public function __construct(
public ?int $perPage = null,
public ?int $page = null,
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/CreateUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class CreateUserRequest extends Request implements HasBody
public function __construct(
protected array $payload,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/DestroyUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class DestroyUserRequest extends Request

public function __construct(
public int $id
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/GetUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class GetUserRequest extends Request
public function __construct(
public ?int $id = null,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/SearchUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class SearchUserRequest extends Request
public function __construct(
public string $term,
public ?int $limit = null,
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/Users/UpdateUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function __construct(
public int $id,
public array $payload,
public bool $expand = false
) {
}
) {}

public function resolveEndpoint(): string
{
Expand Down
12 changes: 6 additions & 6 deletions src/Zammad.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ class Zammad
{
public function user(): UserResource
{
return new UserResource();
return new UserResource;
}

public function userAccessToken(): UserAccessToken
{
return new UserAccessToken();
return new UserAccessToken;
}

public function ticket(): TicketResource
{
return new TicketResource();
return new TicketResource;
}

public function comment(): CommentResource
{
return new CommentResource();
return new CommentResource;
}

public function attachment(): AttachmentResource
{
return new AttachmentResource();
return new AttachmentResource;
}

public function object(): ObjectAttributeResource
{
return new ObjectAttributeResource();
return new ObjectAttributeResource;
}
}
2 changes: 1 addition & 1 deletion tests/Feature/AttachmentResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Support\Facades\Event;

it('can download an attachment', function () {
$content = (new Zammad())->attachment()->download(
$content = (new Zammad)->attachment()->download(
ticketId: 32,
commentId: 111,
attachmentId: 42,
Expand Down
Loading
Loading