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

Minor improvements for PHP 8.4 #173

Merged
merged 1 commit into from
Nov 5, 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
51 changes: 6 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,12 @@ name: CI
on: pull_request

jobs:
cs:
name: PHP CS Fixer
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run PHP CS Fixer
run: composer cs

tests:
name: PestPHP Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.1', '8.2', '8.3', '8.4']

steps:
- name: Checkout repository
Expand All @@ -45,33 +25,11 @@ jobs:
- name: Run tests
run: composer test

integration-tests:
name: PestPHP Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Install chrome
uses: browser-actions/setup-chrome@latest

- name: Run integration tests
run: composer test-integration

stan:
name: PHPStan
stanAndCs:
name: Static Analysis (phpstan) and Code Style (PHP CS Fixer)
runs-on: ubuntu-latest

steps:
Expand All @@ -89,3 +47,6 @@ jobs:

- name: Run PHPStan
run: composer stan

- name: Run PHP CS Fixer
run: composer cs
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.1.3] - 2024-11-05
### Fixed
* Improvements for deprecations in PHP 8.4.

## [2.1.2] - 2024-10-22
### Fixed
* Issue when converting cookie objects received from the chrome-php library.
Expand Down
3 changes: 3 additions & 0 deletions src/Loader/Http/Cookies/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ protected function buildSetCookieHeaderFromBrowserCookie(BrowserCookie $cookie):

foreach ($attributes as $name => $setCookieName) {
$setCookieValue = $cookie->offsetGet($name);

if (empty($setCookieValue)) {
continue;
}
Expand All @@ -146,12 +147,14 @@ protected function buildSetCookieHeaderFromBrowserCookie(BrowserCookie $cookie):
if ($setCookieValue !== -1) {
$parts[] = sprintf('%s=%s', $setCookieName, $this->formatExpiresValue($setCookieValue));
}

continue;
}

// Flag attributes
if ($setCookieValue === true) {
$parts[] = $setCookieName;

continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Steps/Loading/HttpBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function useInputKeyAsBody(string $key): static
*
* If input is an array with string keys, you can choose a key from that array and map it to an HTTP request header.
*/
public function useInputKeyAsHeader(string $key, string $asHeader = null): static
public function useInputKeyAsHeader(string $key, ?string $asHeader = null): static
{
$asHeader = $asHeader ?? $key;

Expand Down
4 changes: 2 additions & 2 deletions src/Stores/SimpleCsvFileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function store(Result $result): void
}

if ($this->isFirstResult) {
fputcsv($fileHandle, array_keys($result->toArray()));
fputcsv($fileHandle, array_keys($result->toArray()), escape: '');

$this->isFirstResult = false;
}
Expand All @@ -41,7 +41,7 @@ public function store(Result $result): void
$resultArray = $this->flattenResultArray($resultArray);
}

fputcsv($fileHandle, array_values($resultArray));
fputcsv($fileHandle, array_values($resultArray), escape: '');

fclose($fileHandle);
}
Expand Down