Skip to content

Commit

Permalink
Support PHP 8.3 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-m authored Jun 12, 2024
1 parent 7c0ea98 commit a76042d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 33 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: [ "8.2", "7.4", "8.0", "8.1" ]
version: [ "8.3", "8.2", "7.4", "8.0", "8.1" ]
install-flags: [ "", "--prefer-lowest" ]
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @see http://editorconfig.org/

# 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

[test/json/*.json]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"require": {
"php": ">7.3 <9.0",
"ext-json": "*",
"getdkan/contracts": "^1.1.2",
"getdkan/contracts": "^1.1.3",
"guzzlehttp/guzzle": "^6.5.8 || >7.4.5",
"opis/json-schema": "^1.0.8"
},
"require-dev": {
"phpunit/phpunit": ">7.5 <8.5 || >=8.5.14 <10.0.0",
"phpunit/phpunit": "^9.6",
"rector/rector": "^0.15.19",
"squizlabs/php_codesniffer": "^3.7",
"symfony/phpunit-bridge": "^7.0"
Expand Down
40 changes: 19 additions & 21 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,42 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;

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

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

$rectorConfig->sets([
SetList::PHP_82,
// Please no dead code or unneeded variables.
SetList::DEAD_CODE,
// Try to figure out type hints.
SetList::TYPE_DECLARATION,
SetList::PHP_74,
// Please no dead code or unneeded variables.
SetList::DEAD_CODE,
// Try to figure out type hints.
SetList::TYPE_DECLARATION,
]);

$rectorConfig->skip([
// Don't throw errors on JSON parse problems. Yet.
// @todo Throw errors and deal with them appropriately.
JsonThrowOnErrorRector::class,
// We like our tags. Please don't remove them.
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessVarTagRector::class,
ArrayShapeFromConstantArrayReturnRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
// Don't throw errors on JSON parse problems. Yet.
// @todo Throw errors and deal with them appropriately.
JsonThrowOnErrorRector::class,
// We like our tags. Please don't remove them.
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessVarTagRector::class,
ArrayShapeFromConstantArrayReturnRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
]);

$rectorConfig->removeUnusedImports();
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
};
2 changes: 0 additions & 2 deletions src/ETL/Load/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Harvest\ETL\Load;

use Harvest\Harvester;
use Harvest\Log\MakeItLog;
use Harvest\Storage\StorageInterface;
use Harvest\Util;

abstract class Load
Expand Down
2 changes: 0 additions & 2 deletions src/ETL/Transform/Transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Harvest\ETL\Transform;

use Harvest\Log\MakeItLog;

abstract class Transform
{

Expand Down
1 change: 0 additions & 1 deletion src/Harvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Harvest;

use Harvest\ETL\Transform\Transform;
use Harvest\ETL\Factory;

class Harvester
Expand Down
2 changes: 1 addition & 1 deletion test/json/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,4 @@
"spatial": "POLYGON ((60.8642578125 29.878755346038, 61.787109375 30.977609093349, 61.7431640625 31.391157522825, 60.7763671875 31.653381399664, 60.8642578125 32.361403315275, 60.556640625 33.137551192346, 60.908203125 33.578014746144, 60.5126953125 33.614619292334, 60.5126953125 34.307143856288, 60.8642578125 34.343436068483, 61.3037109375 35.603718740697, 62.666015625 35.353216101238, 64.5556640625 36.421282443649, 64.86328125 37.195330582801, 65.654296875 37.195330582801, 65.654296875 37.474858084971, 67.9833984375 37.055177106661, 68.7744140625 37.265309955619, 69.345703125 37.125286284967, 69.697265625 37.683820326694, 70.3125 37.683820326694, 70.3125 38.065392351332, 71.0595703125 38.582526159353, 71.279296875 37.78808138412, 71.7626953125 37.926867601481, 71.4990234375 37.405073750177, 71.630859375 36.738884124394, 73.3447265625 37.474858084971, 73.7841796875 37.474858084971, 73.7841796875 37.265309955619, 74.7509765625 37.335224359306, 74.9267578125 37.160316546737, 74.1357421875 36.809284702059, 72.9931640625 36.949891786813, 71.54296875 36.315125147481, 71.2353515625 36.066862132579, 71.5869140625 35.460669951495, 71.54296875 34.813803317113, 71.103515625 34.560859367084, 71.1474609375 34.08906131585, 70.3125 33.979808728725, 69.873046875 33.979808728725, 70.2685546875 33.321348526699, 69.345703125 32.916485347314, 69.2578125 32.324275588877, 69.1259765625 31.802892586707, 68.7744140625 31.578535426473, 68.0712890625 31.802892586707, 67.67578125 31.615965936476, 67.8515625 31.353636941501, 67.4560546875 31.278550858947, 67.0166015625 31.278550858947, 66.4892578125 30.939924331023, 66.2255859375 30.334953881989, 66.357421875 29.91685223307, 65.0390625 29.535229562948, 64.248046875 29.611670115197, 64.2041015625 29.420460341013, 63.4130859375 29.458731185355, 62.6220703125 29.420460341013))",
"title": "Afghanistan Election Districts"
}]
}
}

0 comments on commit a76042d

Please sign in to comment.