Skip to content

Commit

Permalink
Feat: PHP8.4 compatibility (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolaszek authored Dec 5, 2024
1 parent 6b8c258 commit d2c0916
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 87 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI Workflow

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
code-style:
name: Code Style & Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: mbstring, pcntl

- name: Validate composer.json and composer.lock
run: composer validate

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

- name: Check code style
run: vendor/bin/phpcs --standard=psr2 -n src/


tests:
name: Test Suite
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php:
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, curl, zip
coverage: xdebug

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

- name: Run tests
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
32 changes: 0 additions & 32 deletions .scrutinizer.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions src/Helper/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @param UriFactoryInterface|null $factory
* @return UriInterface
*/
function uri(string $uri, UriFactoryInterface $factory = null): UriInterface
function uri(string $uri, ?UriFactoryInterface $factory = null): UriInterface
{
return UriFactory::factory()->createUri($uri, $factory);
}
Expand All @@ -22,7 +22,7 @@ function uri(string $uri, UriFactoryInterface $factory = null): UriInterface
* @return UriInterface
* @throws \RuntimeException
*/
function current_location(UriFactoryInterface $factory = null): UriInterface
function current_location(?UriFactoryInterface $factory = null): UriInterface
{
return UriFactory::factory()->createUriFromCurrentLocation($factory);
}
Expand Down
4 changes: 2 additions & 2 deletions src/UriFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private function getDefaultAdapters()
* @param UriFactoryInterface|null $factory
* @return UriInterface
*/
public function createUri(string $uri = '', UriFactoryInterface $factory = null): UriInterface
public function createUri(string $uri = '', ?UriFactoryInterface $factory = null): UriInterface
{
if (null !== $factory) {
return $factory->createUri($uri);
Expand All @@ -64,7 +64,7 @@ public function createUri(string $uri = '', UriFactoryInterface $factory = null)
* @param UriFactoryInterface|null $factory
* @return UriInterface
*/
public function createUriFromCurrentLocation(UriFactoryInterface $factory = null): UriInterface
public function createUriFromCurrentLocation(?UriFactoryInterface $factory = null): UriInterface
{
if (!isset($_SERVER['HTTP_HOST'])) {
throw new \RuntimeException('$_SERVER[\'HTTP_HOST\'] has not been set.');
Expand Down

0 comments on commit d2c0916

Please sign in to comment.