Skip to content

Commit

Permalink
Merge pull request #32 from lalcebo/refactor/upgrade_to_php_82
Browse files Browse the repository at this point in the history
feat: upgrade to php 8.2
  • Loading branch information
lalcebo authored Apr 19, 2024
2 parents 0f290d9 + e4c1f61 commit 91ccaaf
Show file tree
Hide file tree
Showing 14 changed files with 379 additions and 444 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Integration

on:
pull_request:
push:

permissions:
contents: read # This is required for actions/checkout

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ 8.2, 8.3 ]
stability: [ prefer-lowest, prefer-stable ]

steps:
- uses: actions/checkout@v3
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
coverage: xdebug
ini-values: error_reporting=E_ALL

- name: Install dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Run the tests
run: |
cp phpunit.xml.dist phpunit.xml
composer run test
33 changes: 0 additions & 33 deletions .github/workflows/php-cs-fixer.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/tests.yml

This file was deleted.

16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
vendor/
composer.lock
.phpdoc/
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
phpunit.xml
/.phpunit.result.cache
/.phpunit.cache
/.php-cs-fixer.cache
/.php-cs-fixer.php
/composer.lock
/phpunit.xml
/vendor/
*.swp
*.swo
32 changes: 0 additions & 32 deletions .php-cs-fixer.php

This file was deleted.

33 changes: 21 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
}
],
"require": {
"php": "^7.2|^8.0",
"php": "^8.2.0",
"ext-ctype": "*",
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpunit/phpunit": "^8.0|^9.4",
"friendsofphp/php-cs-fixer": "^v3.54.0",
"laravel/pint": "^1.15",
"pestphp/pest": "^1.23",
"phpstan/phpstan": "^1.10",
"rector/rector": "^1.0",
"roave/security-advisories": "dev-master"
},
"autoload": {
Expand All @@ -41,7 +42,10 @@
},
"minimum-stability": "stable",
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"prefer-stable": true,
"extra": {
Expand All @@ -50,12 +54,17 @@
}
},
"scripts": {
"lint": "parallel-lint . --exclude vendor",
"phpunit": "phpunit --coverage-text -colors=always --configuration phpunit.xml",
"format": "php-cs-fixer fix",
"tests": [
"@lint",
"@phpunit"
"refacto": "rector",
"test:refacto": "rector --dry-run",
"lint": "pint",
"test:lint": "pint --test",
"test:types": "phpstan analyse --ansi",
"test:unit": "pest --colors=always",
"test": [
"@test:refacto",
"@test:lint",
"@test:types",
"@test:unit"
]
}
}
6 changes: 6 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
level: max
paths:
- src

reportUnmatchedIgnoredErrors: true
32 changes: 20 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" enforceTimeLimit="true"
convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
beStrictAboutChangesToGlobalState="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true">
<testsuites>
<testsuite name="SDK PHP Helpers Test Suite">
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

<coverage cacheDirectory=".phpunit.cache/code-coverage" processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
27 changes: 27 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
]);

$rectorConfig->rules([
InlineConstructorDefaultToPropertyRector::class,
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
]);
};
Loading

0 comments on commit 91ccaaf

Please sign in to comment.