Convert the adapter types and the remaining Enums classes to PHP enums (PHP 8.2)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reading the listed adapter type classes and the factories, Database, PaginatorFactory, and Status trait named in the issue. Then trace the listed property and parameter defaults, config and .env inputs, starter project, module templates, and documentation examples that use these classes. Check every conversion against the PHP 8.2 enum value behavior described in the issue; done means all listed classes are converted or have a recorded reason to remain constants, the examples and templates work, the changelog and upgrade guide are updated, and the stated CI checks pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Convert the remaining classes in the Enums folders to PHP enums in 3.2.0, once PHP 8.2 is the minimum: the adapter types, StatusCode, ContentType, Env and ExitCode. The first batch, the classes that can convert on PHP 8.1, is #612.
Why 3.2.0
These classes appear in class constants, property defaults or parameter defaults, mostly as the keys of maps, and PHP 8.1 does not allow Case->value in a constant expression. PHP 8.2 does (the RFC "Fetch properties of enums in const expressions"). I checked it on PHP 8.2.35 and 8.1.34:
public const ADAPTERS = [LoggerType::SINGLE->value => SingleAdapter::class, ...]loads and works on 8.2.- The same code fails on 8.1 with
Fatal error: Constant expression contains invalid operations, and so does the realLoggerFactory.phpwith its keys written that way.
With 8.2 the maps keep their shape. In each place only ->value is added to the keys.
Classes in this ticket
- Adapter types (15):
AppType,ArchiveType,AuthType,CacheType,CaptchaType,CryptorType,DatabaseType,FileSystemType,LangType,LoggerType,MailerType,PaginatorType,RateLimitType,RendererType,SessionType. - Others:
ContentType,Env,ExitCode,StatusCode(62 integer cases).
Places that need ->value
- the 15
ADAPTERSconstants in the factories andDatabase PaginatorFactory::REQUIRED_PARAMS- the
Statustrait's$textsmap, with the status codes as keys - the property and parameter defaults that hold these classes
What to watch
- An enum case is not its value:
StatusCode::OK === 200is false, and anintparameter rejects a case. Comparisons, array keys and parameters that use the value need->value, and text from config or.envneeds::from()or::tryFrom(). - Apps and templates use these constants, for example
AppFactory::create(AppType::WEB, ...)in the starter project andPaginatorTypein the Toolkit templates. Signatures typedstring $typechange.
Out of scope
ExceptionMessages, whose classes extend a shared base class.- The classes in #612.
Breaking changes
- Public constants become enum cases, and the type of some public parameters and return values changes. To be listed in the changelog and in the upgrade guide.
Acceptance criteria
- every class above is converted or has a recorded reason to stay a constants class
- the starter project and the module templates still work, and the docs examples use the new form
composer test,composer cs:check,composer phpstanandcomposer rector:checkpass on every PHP version in the CI matrix- the changelog lists every converted class
- Ngôn ngữ chính
- PHP
- Star
- 43
- Fork
- 22
- Merge trung bình
- 54 phút
- Pull request đã merge (30 ngày)
- 57
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quantum-php/framework
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
quantum-php/framework#692 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
routing testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/framework#547 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
quantum-php/framework#694 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Raise PHPStan to level 9Đang mởrefactoring tech debt
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
quantum-php/framework#693 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
install:debugbar reads the package folder from the working directory and uses the default storage adapterCó thể đã có người làm @armanist đã nhận hôm nay. Đang mởbug console debugbar good first issue
quantum-php/framework#691 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quantum-php/framework
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug origin:interactive status:available
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày