Skip to content

Commit

Permalink
Support PHP 8.3 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-m authored Jun 12, 2024
1 parent f7c9b0d commit 4de38fb
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
tag: << parameters.version >>
parameters:
version:
default: "7.4"
default: "8.3"
description: The `cimg/php` Docker image version tag.
type: string
install-flags:
Expand All @@ -154,7 +154,7 @@ jobs:
- when:
condition:
and:
- equal: [ "8.1", <<parameters.version>> ]
- equal: [ "8.3", <<parameters.version>> ]
- equal: [ "", <<parameters.install-flags>> ]
steps:
- run-phpunit-tests:
Expand All @@ -164,7 +164,7 @@ jobs:
condition:
not:
and:
- equal: [ "8.1", <<parameters.version>> ]
- equal: [ "8.3", <<parameters.version>> ]
- equal: [ "", <<parameters.install-flags>> ]
steps:
- run-phpunit-tests:
Expand All @@ -176,5 +176,5 @@ workflows:
- matrix-conditions:
matrix:
parameters:
version: ["7.4", "8.0", "8.1", "8.2"]
version: ["7.4", "8.0", "8.1", "8.2", "8.3"]
install-flags: ["", "--prefer-lowest"]
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This is the top-most .editorconfig file; do not search in parent directories.
root = true

# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[composer.{json,lock}]
indent_size = 4
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Exclude build/test files from archive
/.circleci export-ignore
/test export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/docs export-ignore
/Doxyfile export-ignore
/doxygen.tag.xml export-ignore
/DoxygenLayout.xml export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/rector.php export-ignore

# Configure diff output for .php and .phar files.
*.php diff=php
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/vendor/
.*
.DS_Store
.ddev
.idea
.phpunit.result.cache
composer.lock
html
!.circleci
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
}
],
"require": {
"php": ">7.3 <8.3",
"php": ">7.3 <8.4",
"ext-json": "*",
"getdkan/contracts": "^1.0.0"
"getdkan/contracts": "^1.1.3"
},
"require-dev": {
"phpunit/phpunit": ">8.5.14 <10.0.0",
"rector/rector": "^0.15.17",
"squizlabs/php_codesniffer": "^3.7"
"rector/rector": "@stable",
"squizlabs/php_codesniffer": "^3.7",
"symfony/phpunit-bridge": "^7.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 10 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" verbose="false">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
</coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<php>
<!-- Don't fail for external dependencies. -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>
<testsuites>
<testsuite name="all">
<directory>test</directory>
Expand Down
12 changes: 1 addition & 11 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,15 @@
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Set\ValueObject\LevelSetList;

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

// Our base version of PHP.
$rectorConfig->phpVersion(PhpVersion::PHP_74);

$rectorConfig->sets([
// Interestingly, LevelSetList::UP_TO_PHP_82 does not preserve PHP 7.4,
// so we have to specify all the PHP versions leading up to it if we
// want to keep 7.4 idioms.
SetList::PHP_74,
SetList::PHP_80,
SetList::PHP_81,
SetList::PHP_82,
// Please no dead code or unneeded variables.
SetList::DEAD_CODE,
// Try to figure out type hints.
Expand All @@ -44,6 +33,7 @@
RemoveUselessVarTagRector::class,
]);

$rectorConfig->removeUnusedImports();
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
};
5 changes: 4 additions & 1 deletion src/Job/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function run(): Result
return $this->result;
}

private function processDataFromRunIt($data)
private function processDataFromRunIt($data): void
{
if ($data instanceof Result) {
$this->result = $data;
Expand Down Expand Up @@ -114,6 +114,9 @@ public function getResult(): Result
return $this->result;
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand Down
5 changes: 4 additions & 1 deletion src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Result implements HydratableInterface
private string $data = "";
private string $error = "";

public function setStatus($status)
public function setStatus($status): void
{
$statuss = [self::WAITING, self::STOPPED, self::IN_PROGRESS, self::ERROR, self::DONE];
if (in_array($status, $statuss)) {
Expand Down Expand Up @@ -53,6 +53,9 @@ public function getError(): string
return $this->error;
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand Down

0 comments on commit 4de38fb

Please sign in to comment.