Skip to content

Commit

Permalink
PHP 8.1 as minimum requirement (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaposa authored Dec 29, 2023
1 parent 6a9911c commit f3b2974
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 28 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- 8.0
- 8.1

steps:
- name: Checkout
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
matrix:
php-version:
- 8.0
- 8.1

steps:
- name: Checkout
Expand Down Expand Up @@ -91,7 +91,6 @@ jobs:
strategy:
matrix:
php-version:
- 8.0
- 8.1
- 8.2
- 8.3
Expand Down Expand Up @@ -131,7 +130,7 @@ jobs:
strategy:
matrix:
php-version:
- 8.0
- 8.1

steps:
- name: Checkout commit
Expand Down
9 changes: 4 additions & 5 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
->exclude('vendor')
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'return_type_declaration' => ['space_before' => 'none'],
'phpdoc_line_span' => ['property' => 'single'],
])
->setRiskyAllowed(true)
->setFinder($finder)
;
]);
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"sort-packages": true
},
"require": {
"php": "^8.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"beberlei/assert": "^3.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17",
"phpstan/phpstan": "^0.12.10",
"phpstan/phpstan-beberlei-assert": "^0.12.2",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpunit/phpunit": "^8.0"
"friendsofphp/php-cs-fixer": "^3.44",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-beberlei-assert": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 5 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ parameters:
- tests
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
earlyTerminatingMethodCalls:
Version\Comparison\Constraint\OperationConstraintParser:
- error
ignoreErrors:
- '~Method [a-zA-Z0-9\\_]+OperationConstraintParser::buildConstraint\(\) should return [a-zA-Z0-9\\_]+OperationConstraint but return statement is missing.~'
- '~Method [a-zA-Z0-9\\_]+::matches\(\) has parameter \$[a-zA-Z0-9]+ with no type specified.~'


includes:
- vendor/phpstan/phpstan-beberlei-assert/extension.neon
Expand Down
27 changes: 18 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="./vendor/autoload.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuite name="Version tests">
<directory>./tests</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<source>
<include>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
</source>
<coverage/>
<testsuites>
<testsuite name="unit">
<directory>./tests</directory>
<exclude>./tests/Extension/ExtensionTest.php</exclude>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="E_ALL"/>
</php>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Comparison/Constraint/OperationConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function it_asserts_provided_version(Version $version, OperationConstrain
$this->assertTrue($constraint->assert($version));
}

public function getConstraintAssertions(): array
public static function getConstraintAssertions(): array
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion tests/Extension/ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Version\Exception\InvalidVersion;
use Version\Extension\Extension;

abstract class ExtensionTest extends TestCase
class ExtensionTest extends TestCase
{
/** @var string|Extension */
protected $extensionClassName;
Expand Down
2 changes: 1 addition & 1 deletion tests/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function it_validates_version_string_input(string $invalidVersion): void
}
}

public function getInvalidVersionStrings(): array
public static function getInvalidVersionStrings(): array
{
return [
'tooManySubVersions' => ['1.5.2.4.4'],
Expand Down

0 comments on commit f3b2974

Please sign in to comment.