Compare commits
7 Commits
c492c52284
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c06afc691 | |||
| 5fd843f8c4 | |||
| 63300de69c | |||
| 35e2287053 | |||
| d4da472725 | |||
| 9239bf9eaa | |||
| bf0d20caf9 |
@@ -18,7 +18,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Validate composer.json and composer.lock
|
- name: Validate composer.json and composer.lock
|
||||||
run: composer validate --strict
|
run: composer validate --strict --no-check-lock
|
||||||
|
|
||||||
- name: Cache Composer packages
|
- name: Cache Composer packages
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
@@ -29,6 +29,12 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-php-
|
${{ runner.os }}-php-
|
||||||
|
|
||||||
|
- name: Configure GitHub OAuth for Composer
|
||||||
|
if: ${{ env.GH_COMPOSER_TOKEN != '' }}
|
||||||
|
env:
|
||||||
|
GH_COMPOSER_TOKEN: ${{ secrets.GH_COMPOSER_TOKEN }}
|
||||||
|
run: composer config --global github-oauth.github.com ${{ secrets.GH_COMPOSER_TOKEN }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --prefer-dist --no-progress
|
run: composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
|
|||||||
+35
-1
@@ -1,4 +1,38 @@
|
|||||||
/vendor/
|
/vendor/
|
||||||
|
/composer.lock
|
||||||
/.php-cs-fixer.cache
|
/.php-cs-fixer.cache
|
||||||
/.phpunit.result.cache
|
/.phpunit.result.cache
|
||||||
composer.lock
|
|
||||||
|
# ---> JetBrains
|
||||||
|
.idea/
|
||||||
|
cmake-build-*/
|
||||||
|
*.iws
|
||||||
|
out/
|
||||||
|
.idea_modules/
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# ---> VisualStudioCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# ---> macOS
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
Icon
|
||||||
|
._*
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Development
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
|
portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
||||||
|
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# tez/utils-enum
|
# tez-utils-enum
|
||||||
|
|
||||||
Composable PHP 8.3 traits that extend native enums with lookup, comparison, navigation, bitmask, label, and collection helpers.
|
Composable PHP 8.3 traits that extend native enums with lookup, comparison, navigation, bitmask, label, and collection helpers.
|
||||||
|
|
||||||
@@ -354,6 +354,11 @@ enum Permission: int
|
|||||||
> All traits use `@phpstan-require-implements` to enforce the correct enum type at static analysis time.
|
> All traits use `@phpstan-require-implements` to enforce the correct enum type at static analysis time.
|
||||||
> Mixing `BitFlagTrait` or `ComparableTrait` with non-int-backed enums will surface as a PHPStan error.
|
> Mixing `BitFlagTrait` or `ComparableTrait` with non-int-backed enums will surface as a PHPStan error.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- PHP 8.3+
|
||||||
|
- No runtime dependencies
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|||||||
+18
-3
@@ -1,16 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "tez/utils-enum",
|
"name": "tezmanian/utils-enum",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"description": " A collection of PHP traits that supercharge native enums with comparison, bit-flag, stepping, collection, and translation helpers — zero dependencies, PHP 8.3+.",
|
"description": " A collection of PHP traits that supercharge native enums with comparison, bit-flag, stepping, collection, and translation helpers — zero dependencies, PHP 8.3+.",
|
||||||
|
"keywords": [
|
||||||
|
"enum",
|
||||||
|
"traits",
|
||||||
|
"flags",
|
||||||
|
"bitflag",
|
||||||
|
"collection",
|
||||||
|
"php"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/tezmanian/tez-utils-enum",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "René Halberstadt",
|
||||||
|
"email": "tezmanian@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Tez\\Utils\\Enum\\": "src/"
|
"Tezmanian\\Utils\\Enum\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Tez\\Utils\\Tests\\Enum\\": "tests/"
|
"Tezmanian\\Utils\\Tests\\Enum\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends EnumTrait for string- and int-backed enums.
|
* Extends EnumTrait for string- and int-backed enums.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitmask helpers for int-backed enums used as flag sets.
|
* Bitmask helpers for int-backed enums used as flag sets.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparison helpers for int-backed enums.
|
* Comparison helpers for int-backed enums.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add-on trait providing collection-style selection helpers for any enum.
|
* Add-on trait providing collection-style selection helpers for any enum.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base trait for pure (unit) enums.
|
* Base trait for pure (unit) enums.
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigation helpers for stepping to the adjacent case by definition order.
|
* Navigation helpers for stepping to the adjacent case by definition order.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Enum;
|
namespace Tezmanian\Utils\Enum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides human-readable labels for enum cases without any framework dependency.
|
* Provides human-readable labels for enum cases without any framework dependency.
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\BackedEnumTrait;
|
use Tezmanian\Utils\Enum\BackedEnumTrait;
|
||||||
|
|
||||||
// String-backed enum
|
// String-backed enum
|
||||||
enum Color: string
|
enum Color: string
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\BackedEnumTrait;
|
use Tezmanian\Utils\Enum\BackedEnumTrait;
|
||||||
use Tez\Utils\Enum\BitFlagTrait;
|
use Tezmanian\Utils\Enum\BitFlagTrait;
|
||||||
|
|
||||||
enum Permission: int
|
enum Permission: int
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\BackedEnumTrait;
|
use Tezmanian\Utils\Enum\BackedEnumTrait;
|
||||||
use Tez\Utils\Enum\ComparableTrait;
|
use Tezmanian\Utils\Enum\ComparableTrait;
|
||||||
|
|
||||||
enum Level: int
|
enum Level: int
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\EnumCollectionTrait;
|
use Tezmanian\Utils\Enum\EnumCollectionTrait;
|
||||||
|
|
||||||
enum Suit: string
|
enum Suit: string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\BackedEnumTrait;
|
use Tezmanian\Utils\Enum\BackedEnumTrait;
|
||||||
use Tez\Utils\Enum\EnumTrait;
|
use Tezmanian\Utils\Enum\EnumTrait;
|
||||||
|
|
||||||
// Pure (unit) enum used across all EnumTrait tests
|
// Pure (unit) enum used across all EnumTrait tests
|
||||||
enum Season
|
enum Season
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ declare(strict_types=1);
|
|||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tez\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\EnumTrait;
|
use Tezmanian\Utils\Enum\EnumTrait;
|
||||||
use Tez\Utils\Enum\StepTrait;
|
use Tezmanian\Utils\Enum\StepTrait;
|
||||||
|
|
||||||
enum OrderStatus
|
enum OrderStatus
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tez\Utils\Tests\Enum;
|
namespace Tezmanian\Utils\Tests\Enum;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Tez\Utils\Enum\BackedEnumTrait;
|
use Tezmanian\Utils\Enum\BackedEnumTrait;
|
||||||
use Tez\Utils\Enum\TranslatableTrait;
|
use Tezmanian\Utils\Enum\TranslatableTrait;
|
||||||
|
|
||||||
enum StatusWithLabels: string
|
enum StatusWithLabels: string
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user