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

Compatibility with PHP 8.0 #4

Merged
merged 8 commits into from
Apr 19, 2022
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
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