Skip to content

Commit

Permalink
Compatibility with PHP 8.0 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz authored Apr 19, 2022
1 parent de83212 commit d56b129
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 11 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI

on: [pull_request, workflow_dispatch]

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- 7.4
- 8.0
- 8.1

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

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

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Run PHPStan
run: composer phpstan


phpcs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- 7.4

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

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

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

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

- name: Run PHP CodeSniffer
run: composer phpcs
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
}
},
"require": {
"php": "~7.4"
"php": ">=7.4"
},
"require-dev": {
"brandembassy/coding-standard": "^5.0"
"brandembassy/coding-standard": "^8.8"
},
"scripts": {
"phpcs": "vendor/bin/phpcs --standard=BrandEmbassyCodingStandard src",
"phpcbf": "./vendor/bin/phpcbf --standard=BrandEmbassyCodingStandard src",
"phpcs": "vendor/bin/phpcs --standard=BrandEmbassyCodingStandard src --runtime-set php_version 70400",
"phpcbf": "./vendor/bin/phpcbf --standard=BrandEmbassyCodingStandard src --runtime-set php_version 70400",
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon src"
},
"config": {
"sort-packages": true
"sort-packages": true,
"lock": false,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
5 changes: 4 additions & 1 deletion src/CurrentDateTimeImmutableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

use DateTimeImmutable;

final class CurrentDateTimeImmutableFactory implements DateTimeImmutableFactory
/**
* @final
*/
class CurrentDateTimeImmutableFactory implements DateTimeImmutableFactory
{
public function getNow(): DateTimeImmutable
{
Expand Down
10 changes: 5 additions & 5 deletions src/FrozenDateTimeImmutableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use DateTimeImmutable;

final class FrozenDateTimeImmutableFactory implements DateTimeImmutableFactory
/**
* @final
*/
class FrozenDateTimeImmutableFactory implements DateTimeImmutableFactory
{
/**
* @var DateTimeImmutable
*/
private $frozenAt;
private DateTimeImmutable $frozenAt;


public function __construct(DateTimeImmutable $frozenAt)
Expand Down

0 comments on commit d56b129

Please sign in to comment.