Skip to content

Commit

Permalink
Bump minimum PHP version to 8.1 (#26)
Browse files Browse the repository at this point in the history
* Bump minimum PHP version to 8.1

* Add & run rector

* Revert phpunit requirement change 😱
  • Loading branch information
marmichalski authored Dec 20, 2023
1 parent 1bb1693 commit 53688f1
Show file tree
Hide file tree
Showing 12 changed files with 544 additions and 598 deletions.
19 changes: 10 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/benchmark export-ignore
/benchmark export-ignore
/static-analysis export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore
composer.lock export-ignore
phpbench.json export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore
composer.lock export-ignore
phpbench.json export-ignore
phpunit.xml.dist export-ignore
psalm.xml export-ignore
psalm.xml export-ignore
rector.php export-ignore
4 changes: 0 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ jobs:
- "lowest"
- "highest"
php:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
UUID SHORTENER
==============
[![Minimum PHP Version](https://img.shields.io/badge/php-%5E7.2%20%7C%7C%20%5E8.0-8892BF.svg)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-%5E8.1-8892BF.svg)](https://php.net/)
[![Build Status](https://github.com/mgrajcarek/uuid-shortener/actions/workflows/build.yaml/badge.svg?branch=master)](https://github.com/mgrajcarek/uuid-shortener/actions/workflows/build.yaml)

A simple shortener library for RFC 4122 compatible UUIDs.
Expand Down
21 changes: 10 additions & 11 deletions benchmark/BaseShorteningBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,21 @@ abstract class BaseShorteningBench
'c15f5581-e047-45b7-a36f-dfef4e7ba4bb',
];

/** @var Shortener */
private $shortener;
/** @var string */
private $shortenedTinyUuid;
/** @var string */
private $shortenedHugeUuid;
/** @var array */
private $shortenedPromoscuousUuids;
private readonly Shortener $shortener;

private readonly string $shortenedTinyUuid;

private readonly string $shortenedHugeUuid;

private readonly array $shortenedPromoscuousUuids;

public function __construct()
{
$this->shortener = $this->newShortener();

$this->shortenedTinyUuid = $this->shortener->reduce(self::TINY_UUID);
$this->shortenedHugeUuid = $this->shortener->reduce(self::HUGE_UUID);
$this->shortenedPromoscuousUuids = \array_map([$this->shortener, 'reduce'], self::UUIDS_TO_BE_SHORTENED);
$this->shortenedPromoscuousUuids = \array_map($this->shortener->reduce(...), self::UUIDS_TO_BE_SHORTENED);
}

abstract protected function newShortener(): Shortener;
Expand All @@ -146,7 +145,7 @@ public function benchShorteningOfHugeUuid(): void

public function benchShorteningOfPromiscuousUuids(): void
{
array_map([$this->shortener, 'reduce'], self::UUIDS_TO_BE_SHORTENED);
array_map($this->shortener->reduce(...), self::UUIDS_TO_BE_SHORTENED);
}

public function benchExpandingOfTinyUuid(): void
Expand All @@ -161,6 +160,6 @@ public function benchExpandingOfHugeUuid(): void

public function benchExpandingOfPromiscuousUuids(): void
{
array_map([$this->shortener, 'expand'], $this->shortenedPromoscuousUuids);
array_map($this->shortener->expand(...), $this->shortenedPromoscuousUuids);
}
}
18 changes: 14 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
"source": "https://github.com/mgrajcarek/uuid-shortener"
},
"require": {
"php": "^7.2 || ^8.0",
"brick/math": "^0.9.1 || ^0.10 || ^0.11 || ^0.12"
"php": "^8.1",
"brick/math": "^0.12"
},
"require-dev": {
"ext-gmp": "^7.2 || ^8.0",
"ext-gmp": "^8.1",
"phpunit/phpunit": "^8.5.26",
"vimeo/psalm": "^4.3.1",
"phpbench/phpbench": "^1.1.1"
"phpbench/phpbench": "^1.1.1",
"rector/rector": "^0.18.12"
},
"suggest": {
"ramsey/uuid": "A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID)",
Expand All @@ -41,5 +42,14 @@
"Benchmark\\Keiko\\Uuid\\Shortener\\": "benchmark/",
"Test\\Keiko\\Uuid\\Shortener\\": "tests/"
}
},
"config": {
"platform": {
"php": "8.1.26"
}
},
"scripts": {
"rector:check": "rector --dry-run --ansi",
"rector:fix": "rector --ansi"
}
}
Loading

0 comments on commit 53688f1

Please sign in to comment.