FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Optimized the `toCssClasses` and `toCssStyles` methods by directly using the input array to simplify the code logic. by huangdijia · Pull Request #7431 · hyperf/hyperf · GitHub

/ hyperf Public

Optimized the toCssClasses and toCssStyles methods by directly using the input array to simplify the code logic. - #7431

Merged
limingxinleo merged 5 commits into
hyperf:3.2from
huangdijia:optimize-arr-helpers
Mar 14, 2026
Merged

Optimized the toCssClasses and toCssStyles methods by directly using the input array to simplify the code logic.#7431
limingxinleo merged 5 commits into
hyperf:3.2from
huangdijia:optimize-arr-helpers

Conversation

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings March 14, 2026 14:34
limingxinleo changed the base branch from master to 3.2 March 14, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

This PR modernizes the codebase for PHP 8.2+/Hyperf 3.2 by updating dependencies and refactoring several components to newer upstream APIs (PHPUnit 11, nikic/php-parser v5, Elastic 8.x, Symfony 6/7), while adding a few new runtime features (HTML responses, pipeline finalizer, async-queue auto consumer registration, new gRPC unary call wrapper).

Changes:

  • Raise minimum PHP requirement to 8.2 across packages and bump Hyperf component constraints to ~3.2.0 (plus other dependency upgrades).
  • Update parsing/tooling and test infrastructure (php-parser v5 APIs, PHPUnit 11, coroutine test runner, phpstan config, CI matrix).
  • Introduce/adjust runtime APIs: Pipeline::finally(), Htmlable/Jsonable::toJson(), async-queue consumer auto-registration, new gRPC UnaryCall.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/validation/src/ValidationRuleParser.php Adjust CSV parsing behavior based on PHP version
src/validation/src/Concerns/ValidatesAttributes.php Switch JSON validation to json_validate()
src/validation/composer.json Bump PHP min/deps; add polyfill
src/translation/composer.json Bump PHP min/deps
src/tracer/src/Aspect/ElasticsearchAspect.php Expand traced targets for Elastic 8.x + string-based FQCNs
src/tracer/composer.json Bump PHP min/deps
src/testing/tests/HttpClientTest.php Migrate coversNothing to attribute
src/testing/tests/DebugTest.php Migrate coversNothing to attribute
src/testing/tests/ClientTest.php Migrate coversNothing to attribute
src/testing/tests/AttributeOnMethodTest.php Add tests for #[NonCoroutine] method attribute
src/testing/tests/AttributeOnClassTest.php Add tests for #[NonCoroutine] class attribute
src/testing/src/TestCase.php Reorder/add testing concerns
src/testing/src/Http/TestResponse.php Typehint __call to PHP 8+ signature
src/testing/src/Constraint/ArraySubset.php Update exporter usage for PHPUnit changes
src/testing/src/Concerns/RunTestsInCoroutine.php Rework coroutine test execution via runBare() + attributes
src/testing/src/Attributes/NonCoroutine.php Add attribute to disable coroutine execution
src/testing/src/AssertableJsonString.php Improve return-type docblock
src/testing/phpunit-patch.php Patch PHPUnit vendor runBare finality
src/testing/composer.json Bump PHP min/deps; require PHPUnit 11; autoload patch file
src/testing/co-phpunit Update PHP minimum + extension checks ordering
src/task/composer.json Bump PHP min/deps; Symfony constraints
src/tappable/src/HigherOrderTapProxy.php Typehint __call
src/tappable/composer.json Bump PHP min
src/swagger/src/Command/GenSchemaCommand.php Update php-parser factory usage
src/swagger/composer.json Bump PHP min/deps
src/support/tests/Stub/Enums.php Add enum test stubs
src/support/src/Traits/InteractsWithData.php Use Carbon directly + doc updates
src/support/src/Reflection/ClassInvoker.php Typehint __call
src/support/src/Optional.php Typehint __call
src/support/composer.json Bump PHP min/deps
src/super-globals/composer.json Bump PHP min/deps
src/stringable/src/Str.php Fix preg_quote delimiter + switch JSON validation
src/stringable/src/Functions.php Typehint dynamic proxy __call
src/stringable/composer.json Bump PHP min/deps; add polyfill; update suggestions
src/stdlib/composer.json Bump PHP min
src/socketio-server/src/SocketIO.php Typehint __call
src/socketio-server/src/Emitter/Future.php Remove deprecated ctor flag
src/socketio-server/composer.json Bump PHP min/deps
src/socket/composer.json Bump PHP min/deps
src/snowflake/composer.json Bump PHP min/deps
src/signal/composer.json Bump PHP min/deps
src/session/src/Handler/FileHandler.php Switch SplFileInfo import to Symfony Finder’s
src/session/composer.json Bump PHP min/deps
src/service-governance/composer.json Bump PHP min/deps
src/service-governance-nacos/composer.json Bump PHP min/deps
src/service-governance-consul/composer.json Bump PHP min/deps
src/server/src/ServerConfig.php Typehint __call
src/server/composer.json Bump PHP min/deps; Symfony console constraints
src/serializer/src/Serializer.php Adjust Symfony serializer interfaces; add supported-types method
src/serializer/src/ScalarNormalizer.php Remove deprecated cacheable interface usage
src/serializer/src/ExceptionNormalizer.php Remove deprecated cacheable interface usage
src/serializer/src/Contract/CacheableSupportsMethodInterface.php Remove deprecated compatibility interface
src/serializer/composer.json Bump PHP min/deps; update suggestions
src/scout/tests/Cases/ElasticsearchEngineTest.php Update mocks for new Elastic client interface
src/scout/src/Engine/ElasticsearchEngine.php Update Elastic client types and index init logic
src/scout/composer.json Bump PHP min/deps
src/rpn/composer.json Bump PHP min
src/rpc/composer.json Bump PHP min/deps
src/rpc-server/composer.json Bump PHP min/deps
src/rpc-multiplex/src/Client.php Typehint __call
src/rpc-multiplex/composer.json Bump PHP min/deps
src/rpc-client/src/ServiceClient.php Typehint __call
src/rpc-client/src/Proxy/ProxyCallVisitor.php Adjust AST name emission
src/rpc-client/src/Proxy/Ast.php Update php-parser factory usage
src/rpc-client/composer.json Bump PHP min/deps
src/retry/src/Retry.php Adjust doc default for whenThrows
src/retry/composer.json Bump PHP min/deps
src/resource/tests/HttpResponse.php Typehint __call
src/resource/src/Concerns/DelegatesToResource.php Typehint __call
src/resource/composer.json Bump PHP min/deps
src/resource-grpc/composer.json Bump PHP min/deps
src/redis/tests/Stub/RedisConnectionStub.php Typehint __call
src/redis/src/RedisConnection.php Typehint __call
src/redis/src/Redis.php Typehint __call
src/redis/composer.json Bump PHP min/deps
src/reactive-x/src/IpcSubject.php Typehint __call
src/reactive-x/composer.json Bump PHP min/deps
src/rate-limit/composer.json Bump PHP min/deps
src/protocol/composer.json Bump PHP min/deps
src/process/composer.json Bump PHP min/deps
src/pool/composer.json Bump PHP min/deps
src/polyfill-coroutine/composer.json Bump PHP min/deps
src/pipeline/src/Pipeline.php Add finalizer callback support (finally)
src/pipeline/composer.json Bump PHP min/deps
src/phar/tests/VisitorTest.php Update expected rewritten code output
src/phar/tests/ConfigFactoryVisitorTest.php Simplify require assignment style
src/phar/src/Ast/Visitor/UnshiftCodeStringVisitor.php Update php-parser factory usage
src/phar/src/Ast/Visitor/RewriteConfigFactoryVisitor.php Update php-parser factory usage
src/phar/src/Ast/Ast.php Update php-parser factory usage
src/phar/composer.json Bump PHP min/deps; upgrade php-parser to v5
src/paginator/src/AbstractPaginator.php Typehint __call
src/paginator/src/AbstractCursorPaginator.php Typehint __call
src/paginator/composer.json Bump PHP min/deps
src/nsq/composer.json Bump PHP min/deps
src/nats/composer.json Bump PHP min/deps
src/nacos/composer.json Bump PHP min/deps
src/model-listener/composer.json Bump PHP min/deps
src/model-cache/composer.json Bump PHP min/deps
src/migration-generator/src/MigrationGenerator.php Update php-parser factory usage
src/migration-generator/src/CreateMigrationVisitor.php Adjust AST generation for column extras
src/migration-generator/composer.json Bump PHP min/deps
src/metric/src/ConfigProvider.php Remove InfluxDB driver bindings
src/metric/publish/metric.php Update InfluxDB config keys (token/bucket/org)
src/metric/composer.json Bump PHP min/deps; change InfluxDB suggestion package
src/memory/composer.json Bump PHP min
src/macroable/src/Macroable.php Typehint __call and align macro dispatch vars
src/macroable/composer.json Bump PHP min
src/logger/tests/LoggerFactoryTest.php Adjust logger config format + API param rename
src/logger/publish/logger.php Revamp logger config to channels/handlers; Monolog v3 Levels
src/logger/composer.json Bump PHP min/deps; require Monolog v3; PSR log constraints
src/load-balancer/composer.json Bump PHP min/deps
src/kafka/src/Promise.php Typehint __call
src/kafka/composer.json Bump PHP min/deps
src/json-rpc/src/JsonRpcTransporter.php Initialize nullable property explicitly
src/json-rpc/src/JsonRpcPoolTransporter.php Initialize nullable property explicitly
src/json-rpc/composer.json Bump PHP min/deps
src/ide-helper/src/Ast.php Update php-parser factory usage
src/ide-helper/composer.json Bump deps
src/http2-client/composer.json Bump PHP min/deps
src/http-server/tests/CoreMiddlewareTest.php Add toJson() in test double
src/http-server/src/Server.php Depend on ResponseEmitterInterface
src/http-server/src/Response.php Typehint __call + improve exception message variable
src/http-server/src/CoreMiddleware.php Add Htmlable response support
src/http-server/src/ConfigProvider.php Bind ResponseEmitterInterface
src/http-server/composer.json Bump PHP min/deps
src/http-message/src/Server/ResponsePlusProxy.php Add mixed return type to __call
src/http-message/src/Server/Chunk/HasChunk.php Add phpstan ignore for always-true check
src/http-message/src/Cookie/SetCookie.php Fix preg_quote delimiter
src/http-message/src/Base/MessageTrait.php Remove laminas-mime dependency; inline header splitting
src/http-message/composer.json Bump PHP min/deps; remove laminas-mime requirement
src/helper/composer.json Bump PHP min/deps
src/guzzle/composer.json Bump PHP min/deps
src/grpc/src/Parser.php Add metadata parsing + make status check public
src/grpc/composer.json Bump PHP min; widen protobuf constraint; bump deps
src/grpc-server/composer.json Bump PHP min/deps
src/grpc-client/tests/RouteGuideClientTest.php Update unary call usage to ->wait()
src/grpc-client/tests/GoUserServiceTest.php Update unary call usage to ->wait()
src/grpc-client/src/UnaryCall.php Add unary call wrapper with deferred parsing
src/grpc-client/src/BaseClient.php Return UnaryCall from _simpleRequest + typehint __call
src/grpc-client/composer.json Bump PHP min/deps
src/graphql/composer.json Bump PHP min/deps
src/framework/tests/StdoutLoggerTest.php Adjust assertions for timestamped stdout logger
src/framework/tests/ApplicationFactoryTest.php Add test for command registration behavior
src/framework/src/Logger/StdoutLogger.php Add timestamp prefix in log messages
src/framework/src/ApplicationFactory.php Switch to bulk addCommands()
src/framework/composer.json Bump PHP min/deps
src/filesystem/composer.json Bump PHP min/deps
src/exception-handler/composer.json Bump PHP min/deps
src/event/tests/ListenerProviderTest.php Add tests for listener caching and ordering
src/event/tests/Listener/Alpha3Listener.php Add new listener stub
src/event/tests/Listener/Alpha2Listener.php Add new listener stub
src/event/src/ListenerProvider.php Add listener cache per event class
src/event/composer.json Bump PHP min/deps
src/etcd/composer.json Bump PHP min/deps
src/elasticsearch/tests/ClientFactoryTest.php Update for Elastic 8 client + container injection
src/elasticsearch/src/ClientBuilderFactory.php Switch to Elastic client builder + optional Hyperf Guzzle client
src/elasticsearch/composer.json Bump PHP min; widen elasticsearch client constraint
src/dispatcher/composer.json Bump PHP min/deps
src/di/tests/Stub/LazyLoad/FooLazyLoad.php Add mixed return type to __call
src/di/tests/Stub/LazyLoad/BarLazyLoad.php Add mixed return type to __call
src/di/tests/PublicMethodVisitorTest.php Update php-parser factory usage
src/di/tests/InterfaceLazyProxyBuilderTest.php Update php-parser factory + tweak string escaping
src/di/tests/ClassLazyProxyBuilderTest.php Update php-parser factory + tweak string escaping
src/di/src/ScanHandler/ProcScanHandler.php Adjust proc_open descriptors
src/di/src/ReflectionManager.php Change file reading logic for parser
src/di/src/LazyLoader/LazyProxyTrait.php Typehint __call and adjust invocation
src/di/src/Aop/ProxyTrait.php Remove deprecated params-map helper
src/di/src/Aop/ProxyCallVisitor.php Update closure use nodes for php-parser v5
src/di/src/Aop/AstVisitorRegistry.php Add explanatory comments
src/di/src/Aop/Ast.php Update php-parser factory usage
src/di/composer.json Bump PHP min/deps; upgrade php-parser to v5; Symfony finder constraints
src/devtool/composer.json Bump PHP min/deps
src/db/src/MySQLConnection.php Typehint __call
src/db/src/DB.php Typehint __call
src/db/composer.json Bump PHP min/deps
src/db-connection/src/Db.php Typehint __call
src/db-connection/src/Connection.php Typehint __call
src/db-connection/composer.json Bump PHP min/deps
src/database/types/Model/Collection.php Update static type assertions
src/database/types/Model/Builder.php Update static type assertions
src/database/tests/QueryBuilderTest.php Update behavior test for negative limits
src/database/tests/ModelGenerateTest.php Update php-parser factory usage
src/database/tests/GenModelTest.php Update php-parser usage + token retrieval
src/database/src/Schema/Schema.php Typehint __call
src/database/src/Schema/Blueprint.php Switch soft deletes to dateTime variants
src/database/src/Query/Builder.php Typehint __call; enforce non-negative limit
src/database/src/Model/Relations/Relation.php Typehint __call
src/database/src/Model/Relations/MorphTo.php Typehint __call; buffer variable names changed
src/database/src/Model/Model.php Typehint __call; add return type to toJson
src/database/src/Model/Concerns/HasUuids.php Delegate to shared unique-string-id trait
src/database/src/Model/Concerns/HasUlids.php Delegate to shared unique-string-id trait
src/database/src/Model/Concerns/HasAttributes.php Ensure timezone is provided when creating from timestamp
src/database/src/Model/Builder.php Typehint __call and return types for macro behavior
src/database/src/Exception/QueryException.php Add connectionName property
src/database/src/Connectors/Connector.php Use PDO::connect on PHP 8.4+
src/database/src/Connection.php Include connection name in query exceptions
src/database/src/Commands/ModelCommand.php Update php-parser factory usage + token retrieval
src/database/src/Commands/Ast/ModelUpdateVisitor.php Update php-parser v5 node types
src/database/src/Commands/Ast/GenerateModelIDEVisitor.php Use helper to create nullable type nodes
src/database/composer.json Bump PHP min/deps; widen carbon; update suggestions
src/database-sqlite/composer.json Bump PHP min/deps
src/database-pgsql/src/PostgreSqlSwooleExtConnection.php Pass connection name into QueryException
src/database-pgsql/composer.json Bump PHP min/deps
src/dag/src/Dag.php Add phpstan ignore for always-true check
src/dag/composer.json Bump PHP min/deps
src/crontab/tests/CrontabTest.php Add timestamp/timezone regression test
src/crontab/src/Strategy/Executor.php Use float diff-in-real-seconds
src/crontab/composer.json Bump PHP min/deps; widen carbon
src/coroutine/src/Parallel.php Clear results/throwables without unset
src/coroutine/src/Concurrent.php Typehint __call
src/coroutine/composer.json Bump PHP min/deps
src/coordinator/src/Listener/ResumeExitCoordinatorListener.php Remove deprecated listener
src/coordinator/composer.json Bump PHP min
src/contract/src/Jsonable.php Add toJson() to interface
src/contract/src/Htmlable.php Add new Htmlable interface
src/contract/composer.json Bump PHP min
src/context/tests/Stub/ContextMixin.php Add mixin stub for Macroable testing
src/context/tests/ContextTest.php Add macro/mixin tests
src/context/src/Traits/CoroutineProxy.php Typehint __call
src/context/src/Context.php Add Macroable support
src/context/composer.json Bump PHP min; add macroable dependency
src/consul/src/ConsulResponse.php Typehint __call
src/consul/composer.json Bump PHP min/deps
src/constants/composer.json Bump PHP min/deps
src/config/composer.json Bump PHP min/deps; Symfony finder constraints
src/config-zookeeper/composer.json Bump PHP min/deps
src/config-nacos/composer.json Bump PHP min/deps
src/config-etcd/composer.json Bump PHP min/deps
src/config-center/composer.json Bump PHP min/deps
src/config-apollo/composer.json Bump PHP min/deps
src/config-aliyun-acm/composer.json Bump PHP min/deps
src/conditionable/src/HigherOrderWhenProxy.php Typehint __call
src/conditionable/composer.json Bump PHP min
src/command/src/Command.php Invoke handler via callable array
src/command/composer.json Bump PHP min/deps; Symfony console constraints
src/collection/tests/LazyCollectionTest.php Migrate coversNothing to attribute
src/collection/tests/LazyCollectionIsLazyTest.php Migrate coversNothing to attribute
src/collection/src/Traits/EnumeratesValues.php Optimize partition; add toJson(): string
src/collection/src/HigherOrderCollectionProxy.php Typehint __call
src/collection/src/Functions.php Update head/last implementations
src/collection/src/Enumerable.php Add toJson(): string to interface
src/collection/composer.json Bump PHP min/deps; add polyfills
src/codec/composer.json Bump PHP min/deps
src/code-parser/tests/PhpParserTest.php Update php-parser factory usage + API changes
src/code-parser/composer.json Bump PHP min/deps; update suggestions
src/circuit-breaker/composer.json Bump PHP min/deps
src/carbon/tests/CarbonTest.php Add timestamp/timezone regression test
src/carbon/composer.json Bump PHP min/deps; widen carbon
src/cache/tests/Cases/RedisDriverTest.php Update cache config structure in tests
src/cache/src/CacheManager.php Support old/new cache config shapes; nullable driver selection
src/cache/src/Cache.php Typehint __call
src/cache/publish/cache.php Add default + stores structure; env support
src/cache/composer.json Bump PHP min/deps
src/async-queue/tests/RedisDriverTest.php Update expected serialized size
src/async-queue/src/Listener/RegisterConsumerProcessesListener.php Add listener to auto-register consumer processes
src/async-queue/src/JobMessage.php Remove legacy serialization compatibility
src/async-queue/src/JobInterface.php Add getPoolName() to interface
src/async-queue/src/Job.php Use get_object_vars; default pool name
src/async-queue/src/Functions.php Default dispatch pool via job pool name
src/async-queue/src/ConsumerManager.php Create/register consumer processes from config
src/async-queue/src/ConfigProvider.php Register new listener
src/async-queue/publish/async_queue.php Add enable config toggle (default true)
src/async-queue/composer.json Bump PHP min/deps
src/amqp/composer.json Bump PHP min/deps
rector.php Disable PHPUnit rector set
phpunit.xml.dist Update PHPUnit schema to v11
phpstan.neon.dist Phpstan config updates/ignore rules
docs/zh-tw/async-queue.md Document async-queue enable flag + configuration modes
docs/zh-hk/async-queue.md Document async-queue enable flag + configuration modes
docs/zh-cn/async-queue.md Document async-queue enable flag + configuration modes
docs/en/async-queue.md Document async-queue enable flag + configuration modes
.github/workflows/test.yml Update CI matrix (PHP >= 8.2) and quoting
.github/workflows/docs.yml Bump docs build PHP version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 25 to 66
Comment on lines 266 to 269
Comment on lines 27 to 53
Comment on lines 1011 to 1018
Comment on lines 17 to 25
limingxinleo merged commit 62655fa into hyperf:3.2 Mar 14, 2026
77 checks passed
huangdijia deleted the optimize-arr-helpers branch March 14, 2026 14:48
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL