Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 3 additions & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@4

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
php-version: '8.5'
coverage: none

- name: Install composer dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.1, 8.2, 8.3, 8.4 ]
php: [ 8.2, 8.3, 8.4, 8.5 ]
stability: [ prefer-lowest, prefer-stable ]

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"homepage": "https://github.com/saloonphp/saloon",
"require": {
"php": "^8.1",
"php": "^8.2",
"guzzlehttp/guzzle": "^7.6",
"guzzlehttp/promises": "^1.5 || ^2.0",
"guzzlehttp/psr7": "^2.0",
Expand All @@ -29,12 +29,11 @@
"require-dev": {
"ext-simplexml": "*",
"friendsofphp/php-cs-fixer": "^3.5",
"illuminate/collections": "^9.39 || ^10.0",
"illuminate/collections": "^10.0 || ^11.0 || ^12.0",
"league/flysystem": "^3.0",
"pestphp/pest": "^2.36.0 || ^3.8.2",
"pestphp/pest": "^2.36.0 || ^3.8.2 || ^4.1.4",
"phpstan/phpstan": "^2.1.13",
"saloonphp/xml-wrangler": "^1.1",
"spatie/ray": "^1.33",
"symfony/dom-crawler": "^6.0 || ^7.0",
"symfony/var-dumper": "^6.3 || ^7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function buildPath(string $path): string
{
$trimRules = DIRECTORY_SEPARATOR . ' ';

return rtrim($this->baseDirectory, $trimRules) . DIRECTORY_SEPARATOR . ltrim($path, $trimRules);
return mb_rtrim($this->baseDirectory, $trimRules) . DIRECTORY_SEPARATOR . mb_ltrim($path, $trimRules);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/URLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public static function join(string $baseUrl, string $endpoint): string
}

if ($endpoint !== '/') {
$endpoint = ltrim($endpoint, '/ ');
$endpoint = mb_ltrim($endpoint, '/ ');
}

$requiresTrailingSlash = ! empty($endpoint) && $endpoint !== '/';

$baseEndpoint = rtrim($baseUrl, '/ ');
$baseEndpoint = mb_rtrim($baseUrl, '/ ');

$baseEndpoint = $requiresTrailingSlash ? $baseEndpoint . '/' : $baseEndpoint;

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Auth/TokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function __construct(
*/
public function set(PendingRequest $pendingRequest): void
{
$pendingRequest->headers()->add('Authorization', trim($this->prefix . ' ' . $this->token));
$pendingRequest->headers()->add('Authorization', mb_trim($this->prefix . ' ' . $this->token));
}
}
2 changes: 1 addition & 1 deletion src/Http/BaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class BaseResource
/**
* Constructor
*/
public function __construct(readonly protected Connector $connector)
public function __construct(protected readonly Connector $connector)
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/OAuth2/AuthorizationCodeGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getAuthorizationUrl(array $scopes = [], ?string $state = null, s
]);

$query = http_build_query($queryParameters, '', '&', PHP_QUERY_RFC3986);
$query = trim($query, '?&');
$query = mb_trim($query, '?&');

$url = URLHelper::join($this->resolveBaseUrl(), $config->getAuthorizeEndpoint());

Expand Down
8 changes: 4 additions & 4 deletions tests/Fixtures/Authenticators/CustomOAuthAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class CustomOAuthAuthenticator extends AccessTokenAuthenticator
* Constructor
*/
public function __construct(
readonly public string $accessToken,
readonly public string $greeting,
readonly public ?string $refreshToken = null,
readonly public ?DateTimeImmutable $expiresAt = null,
public readonly string $accessToken,
public readonly string $greeting,
public readonly ?string $refreshToken = null,
public readonly ?DateTimeImmutable $expiresAt = null,
) {
//
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Requests/QueryParameterRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QueryParameterRequest extends Request
/**
* Constructor
*/
public function __construct(readonly public string $endpoint = '/user')
public function __construct(public readonly string $endpoint = '/user')
{
//
}
Expand Down
Loading