Skip to content

Commit

Permalink
PHP 8.1 support (#31)
Browse files Browse the repository at this point in the history
* Add PHP 8.1 support
* Add PHP 8.0 support
* Remove PHP 7.2 support
* Remove PHP 7.3 support
  • Loading branch information
markwalet authored Dec 30, 2021
1 parent db6020c commit 7660524
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 66 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: coverage
on: [push, pull_request]

jobs:
tests:
coverage:
runs-on: ubuntu-latest

name: Coverage
Expand All @@ -16,13 +16,13 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-7.4-illuminate-8.*-composer-${{ hashFiles('composer.json') }}
key: dependencies-php-8.1-illuminate-8.*-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
php-version: 8.1
extensions: dom, libxml, mbstring, zip, pcntl
coverage: xdebug

- name: Install dependencies
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 7.2, 7.3, 7.4 ]
illuminate: [ 6.*, 7.*, 8.* ]
php: [ 7.4, 8.0, 8.1 ]
illuminate: [6.*, 7.*, ~8.74]
stability: [ prefer-lowest, prefer-stable ]
include:
- illuminate: 6.*
testbench: 4.*
- illuminate: 7.*
testbench: 5.*
- illuminate: 8.*
- illuminate: ~8.74
testbench: 6.*
exclude:
- php: 7.4
- php: 8.1
illuminate: 7.*
- php: 8.1
illuminate: 6.*
- php: 7.2
illuminate: 8.*

name: P${{ matrix.php }} - I${{ matrix.illuminate }} - ${{ matrix.stability }}

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

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-illuminate-${{ matrix.illuminate }}-composer-${{ hashFiles('composer.json') }}
Expand All @@ -45,17 +45,14 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
extensions: dom, libxml, mbstring, zip, pcntl
coverage: none

- name: Install dependencies
run: |
composer require "illuminate/console:${{ matrix.illuminate }}" --no-interaction --no-update
composer require "illuminate/contracts:${{ matrix.illuminate }}" --no-interaction --no-update
composer require "illuminate/support:${{ matrix.illuminate }}" --no-interaction --no-update
composer require "illuminate/filesystem:${{ matrix.illuminate }}" --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest
composer require "laravel/framework:${{ matrix.illuminate }}" --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --verbose
4 changes: 4 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
preset: laravel

disabled:
- laravel_phpdoc_alignment
- laravel_phpdoc_separation
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Release Notes

## [Unreleased](https://github.com/markwalet/laravel-changelog/compare/v1.4.1...master)

## Added
- Added PHP 8.0 support
- Added PHP 8.1 support

## Removed
- Removed PHP 7.2 support
- Removed PHP 7.3 support

### Fixed
- Fixed recursive folder creation ([#26](https://github.com/markwalet/laravel-changelog/issues/26))

Expand Down
10 changes: 4 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
}
],
"require": {
"php": ">=7.1.3",
"illuminate/console": "6.*|7.*|8.*",
"illuminate/contracts": "6.*|7.*|8.*",
"illuminate/support": "6.*|7.*|8.*",
"illuminate/filesystem": "6.*|7.*|8.*",
"php": "~7.4|8.*",
"laravel/framework": "6.*|7.*|~8.74",
"markwalet/laravel-git-state": "~1.0",
"ext-simplexml": "*",
"ext-dom": "*"
},
"require-dev": {
"phpunit/phpunit": "~7.0|~8.0",
"phpunit/phpunit": "~9.3",
"mockery/mockery": "~1.4",
"orchestra/testbench": "4.*|5.*|6.*"
},
"autoload": {
Expand Down
26 changes: 12 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
processIsolation="false"
stopOnFailure="false">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<directory suffix=".php">./src/Exceptions/*</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Changelog Test Suite">
<directory suffix="Test.php">./tests/</directory>
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".php">./src/Exceptions/*</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
12 changes: 4 additions & 8 deletions src/Change.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@

class Change
{
/**
* @var string
*/
private $type;
/** @var string */
private string $type;

/**
* @var string
*/
private $message;
/** @var string */
private string $message;

/**
* Change constructor.
Expand Down
8 changes: 2 additions & 6 deletions src/ChangelogFormatterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@

class ChangelogFormatterFactory
{
/**
* The application instance.
*
* @var Application
*/
protected $app;
/** @var Application */
protected Application $app;

/**
* ChangelogFormatterFactory constructor.
Expand Down
6 changes: 5 additions & 1 deletion src/Concerns/CanSortReleases.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public function sortVersions(array $versions): array
return 1;
}

return version_compare($first, $second, '<=');
if (strtolower($first[0]) === 'v' && strtolower($second[0]) === 'v') {
return version_compare($second, $first);
}

return strcmp($second, $first);
});
}

Expand Down
6 changes: 2 additions & 4 deletions src/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

class Feature
{
/**
* @var Change[]|array
*/
private $changes;
/** @var Change[]|array */
private array $changes;

/**
* Feature constructor.
Expand Down
12 changes: 4 additions & 8 deletions src/Release.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@

class Release
{
/**
* @var Change[]|array
*/
private $changes;
/** @var Change[]|array */
private array $changes;

/**
* @var string
*/
private $version;
/** @var string */
private string $version;

/**
* Change constructor.
Expand Down

0 comments on commit 7660524

Please sign in to comment.