diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 594308d..591f695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,6 @@ jobs: php-version: - "8.3" - "8.2" - - "8.1" dependencies: - "highest" @@ -69,7 +68,7 @@ jobs: php-${{ matrix.php-version }}-deps-${{ matrix.dependencies }} - name: Remove PHP-CS-Fixer if not called - if: matrix.php-version != '8.1' || matrix.dependencies != 'highest' + if: matrix.php-version != '8.2' || matrix.dependencies != 'highest' run: composer remove --dev --no-update "friendsofphp/php-cs-fixer"; - name: Install dependencies (low) @@ -100,7 +99,7 @@ jobs: - name: PHPUnit run: | - if [ "${{ matrix.php-version }}" = "8.1" ] && [ "${{ matrix.dependencies }}" = "highest" ]; then + if [ "${{ matrix.php-version }}" = "8.2" ] && [ "${{ matrix.dependencies }}" = "highest" ]; then php -dmemory_limit=-1 vendor/phpunit/phpunit/phpunit --exclude-group=efficiency; composer global require scrutinizer/ocular; ~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover build/coverage-phpunit/clover.xml; @@ -110,7 +109,7 @@ jobs: - name: Behat run: | - if [ "${{ matrix.php-version }}" = "8.1" ] && [ "${{ matrix.dependencies }}" = "highest" ]; then + if [ "${{ matrix.php-version }}" = "8.2" ] && [ "${{ matrix.dependencies }}" = "highest" ]; then php -dmemory_limit=-1 vendor/behat/behat/bin/behat --strict; ~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover build/coverage-behat/clover.xml; else @@ -118,7 +117,7 @@ jobs: fi; - name: Check code style - if: matrix.php-version == '8.1' && matrix.dependencies == 'highest' + if: matrix.php-version == '8.2' && matrix.dependencies == 'highest' run: vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --allow-risky=yes --format=checkstyle | cs2pr @@ -132,7 +131,6 @@ jobs: php-version: - "8.3" - "8.2" - - "8.1" dependencies: - "highest" diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e4e0c50..a326455 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -14,6 +14,7 @@ '@Symfony:risky' => true, '@PHP80Migration:risky' => true, '@PHP81Migration' => true, + '@PHP82Migration' => true, 'concat_space' => ['spacing' => 'one'], 'fopen_flags' => ['b_mode' => true], 'native_function_invocation' => ['include' => ['@all']], diff --git a/.scrutinizer.yml b/.scrutinizer.yml index c276268..3e8c606 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -15,7 +15,7 @@ build: environment: # Languages php: - version: "8.1" + version: "8.2" ini: memory_limit: "-1" diff --git a/CHANGELOG.md b/CHANGELOG.md index 0273abe..69bf415 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ exceptions are disabled). ### Changed - - Minimum PHP version is now 8.1 + - Minimum PHP version is now 8.2 - Exceptions are now in the `DVDoug\BoxPacker\Exception` namespace (previously `DVDoug\BoxPacker`) - The signature of the `canBePacked` method on the `ConstrainedPlacementItem` interface has been changed to replace the first two arguments(`Box $box`, `PackedItemList $alreadyPackedItems`) with `PackedBox $packedBox`. This allows diff --git a/composer.json b/composer.json index a214a9e..c7d74a3 100644 --- a/composer.json +++ b/composer.json @@ -12,16 +12,16 @@ ], "license": "MIT", "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "psr/log": "^1.0||^2.0||^3.0" }, "require-dev": { "behat/behat": "^3.13", "dvdoug/behat-code-coverage": "^5.3.1", - "friendsofphp/php-cs-fixer": "^3.22.0", - "monolog/monolog": "^3.4", - "phpunit/phpunit": "^10.2" + "friendsofphp/php-cs-fixer": "^3.38.2", + "monolog/monolog": "^3.5", + "phpunit/phpunit": "^10.4" }, "config": { "preferred-install": { @@ -38,7 +38,7 @@ }, "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.x-dev" } } } diff --git a/docs/installation.rst b/docs/installation.rst index 4801dc0..1d54301 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -13,7 +13,7 @@ If you don't want to use Composer, the code is available to download from `GitHu Requirements ------------ -BoxPacker v4 is compatible with PHP 8.1+ +BoxPacker v4 is compatible with PHP 8.2+ Versioning ---------- diff --git a/src/PackedBox.php b/src/PackedBox.php index 6c6f9be..f0dbb28 100644 --- a/src/PackedBox.php +++ b/src/PackedBox.php @@ -29,11 +29,11 @@ /** * A "box" with items. */ -class PackedBox implements JsonSerializable +readonly class PackedBox implements JsonSerializable { - protected readonly int $itemWeight; + protected int $itemWeight; - protected readonly float $volumeUtilisation; + protected float $volumeUtilisation; /** * Get packed weight. @@ -202,7 +202,7 @@ public function generateVisualisationURL(): string return 'https://boxpacker.io/en/master/visualiser.html?packing=' . json_encode($data, flags: JSON_THROW_ON_ERROR | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } - public function __construct(public readonly Box $box, public readonly PackedItemList $items) + public function __construct(public Box $box, public PackedItemList $items) { assert($this->assertPackingCompliesWithRealWorld()); } diff --git a/src/PackedItem.php b/src/PackedItem.php index 14168d4..5991092 100644 --- a/src/PackedItem.php +++ b/src/PackedItem.php @@ -15,18 +15,18 @@ /** * A packed item. */ -class PackedItem implements JsonSerializable +readonly class PackedItem implements JsonSerializable { - public readonly int $volume; + public int $volume; public function __construct( - public readonly Item $item, - public readonly int $x, - public readonly int $y, - public readonly int $z, - public readonly int $width, - public readonly int $length, - public readonly int $depth + public Item $item, + public int $x, + public int $y, + public int $z, + public int $width, + public int $length, + public int $depth ) { } diff --git a/src/WorkingVolume.php b/src/WorkingVolume.php index f2d3a4c..757c39a 100644 --- a/src/WorkingVolume.php +++ b/src/WorkingVolume.php @@ -14,13 +14,13 @@ * Class WorkingVolume. * @internal */ -class WorkingVolume implements Box, JsonSerializable +readonly class WorkingVolume implements Box, JsonSerializable { public function __construct( - private readonly int $width, - private readonly int $length, - private readonly int $depth, - private readonly int $maxWeight + private int $width, + private int $length, + private int $depth, + private int $maxWeight ) { }