Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum PHP version to 8.1 #26

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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