-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #165 V2: Rewrite with PHP 8.1 enums (ogizanagi)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- V2: Rewrite with PHP 8.1 enums WIP POC to observe what could be relevant to keep from this lib and its integrations while moving to PHP 8.1 native enums… Relates to #124 --- #### random thoughts - [x] [WeakMap/SplObjStorage](https://wiki.php.net/rfc/enumerations#splobjectstorage_and_weakmaps) for readables? - [x] For now, no requirements for a FlaggedEnumInterface, no specific methods. But it requires an int backed enum. Drop the interface and replace by backed type reflection checks? #### notes - Enum may not include __toString (from PHP) - Cannot implement FlaggedEnum as before, since we can only define cases for each bit, but cannot hold a $value and have a FlaggedEnum instance with multiple bits. Instead, we might need a FlagBag. Will impact forms, dbal types, js generation, … - readables for Flagged enum combination might be difficult to write using the same interfaces. Dedicated system for a FlagBag? - FlagBag controller arg resolver? Commits ------- e21a5bf Update CI branches 8019e3d Update cs-fixer 5135227 Remove FlagEnumInterface & add docs 2d1c212 Complete README.md 7e1d3e4 Add Symfony Bundle & configuration for generating BDAL types e4905fb Basic doctrine dbal types dumper 2117f82 Basic Doctrine types 7db6f59 Clean the deps & CI 69f3a71 Add Symfony Form type with readable enums supports ae2bcc6 Use enum cases as keys in readables b7fa48b Base readable implem uses annotations 1633fae V2: Rewrite with PHP 8.1 enums
- Loading branch information
Showing
171 changed files
with
1,601 additions
and
10,518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ indent_size = 2 | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
max_line_length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
workflow_dispatch: ~ | ||
push: | ||
branches: | ||
- 1.x | ||
- 2.x | ||
pull_request: ~ | ||
|
||
jobs: | ||
|
@@ -39,48 +39,30 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
include: | ||
# Previous Symfony versions & lowest deps | ||
- name: 'Test lowest deps [Linux, PHP 7.3]' | ||
# Lowest deps | ||
- name: 'Test lowest deps [Linux, PHP 8.1]' | ||
os: 'ubuntu-latest' | ||
php: '7.3' | ||
php: '8.1' | ||
composer-flags: '--prefer-lowest' | ||
mongodb: true | ||
allow-unstable: true | ||
|
||
# Previous Symfony versions | ||
- name: 'Test Symfony 5.3 [Linux, PHP 8.0]' | ||
os: 'ubuntu-latest' | ||
php: '8.0' | ||
symfony: '5.3.*' | ||
# … | ||
|
||
# Previous PHP versions | ||
- name: 'Test Symfony 5.4 [Linux, PHP 7.3]' | ||
os: 'ubuntu-latest' | ||
php: '7.3' | ||
symfony: '5.4.*@dev' | ||
allow-unstable: true | ||
|
||
- name: 'Test Symfony 5.4 [Linux, PHP 7.4] (with code coverage)' | ||
os: 'ubuntu-latest' | ||
php: '7.4' | ||
mongodb: true | ||
symfony: '5.4.*@dev' | ||
allow-unstable: true | ||
code-coverage: true | ||
# … | ||
|
||
# Most recent versions | ||
- name: 'Test Symfony 5.4 [Linux, PHP 8.1]' | ||
os: 'ubuntu-latest' | ||
php: '8.1' | ||
symfony: '5.4.*@dev' | ||
# For now: Could not install mongodb on PHP 8.1.0-dev | ||
#mongodb: true | ||
allow-unstable: true | ||
|
||
- name: 'Test Symfony 5.4 [Windows, PHP 8.0]' | ||
- name: 'Test Symfony 5.4 [Windows, PHP 8.1]' | ||
os: 'windows-latest' | ||
php: '8.0' | ||
php: '8.1' | ||
symfony: '5.4.*@dev' | ||
mongodb: true | ||
allow-unstable: true | ||
|
||
- name: 'Test Symfony 6.0 [Linux, PHP 8.1]' | ||
|
@@ -90,13 +72,11 @@ jobs: | |
allow-unstable: true | ||
|
||
# Bleeding edge (unreleased dev versions where failures are allowed) | ||
- name: 'Test next Symfony [Linux, PHP 8.2] (allowed failure)' | ||
- name: 'Test next Symfony [Linux, PHP 8.1] (allowed failure)' | ||
os: 'ubuntu-latest' | ||
php: '8.2' | ||
php: '8.1' | ||
symfony: '6.1.*@dev' | ||
composer-flags: '--ignore-platform-req php' | ||
# For now: Could not install mongodb on PHP 8.1.0-dev | ||
#mongodb: true | ||
allow-unstable: true | ||
allow-failure: true | ||
|
||
|
@@ -113,20 +93,10 @@ jobs: | |
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: pdo_sqlite | ||
coverage: pcov | ||
extensions: pdo_sqlite ${{ matrix.mongodb && ', mongodb' }} | ||
tools: 'composer:v2,flex' | ||
|
||
- name: 'Start MongoDB (Linux)' | ||
uses: supercharge/[email protected] | ||
if: ${{ matrix.mongodb && matrix.os == 'ubuntu-latest' }} | ||
|
||
- name: 'Start MongoDB (Windows)' | ||
uses: crazy-max/ghaction-chocolatey@v1 | ||
with: | ||
args: install mongodb | ||
if: ${{ matrix.mongodb && matrix.os == 'windows-latest' }} | ||
|
||
- name: 'Get composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
@@ -142,14 +112,6 @@ jobs: | |
run: composer config minimum-stability dev | ||
if: ${{ matrix.allow-unstable }} | ||
|
||
- name: 'Remove packages not allowing Symfony 6 yet' | ||
run: composer remove --no-update ${{ matrix.composer-flags }} --dev --no-interaction --ansi "nelmio/alice" "api-platform/core" | ||
if: ${{ matrix.symfony == '6.0.*@dev' }} | ||
|
||
- name: 'Require Doctrine MongoDB dependencies' | ||
run: composer require --no-update ${{ matrix.composer-flags }} --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.2" "doctrine/mongodb-odm-bundle:^4.3" | ||
if: ${{ matrix.mongodb }} | ||
|
||
- name: 'Install dependencies' | ||
run: composer update --prefer-dist ${{ matrix.composer-flags }} --ansi | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.