Skip to content

Conversation

@huangdijia
Copy link
Contributor

@huangdijia huangdijia commented Sep 19, 2025

Summary

  • Updates the huangdijia/php-coding-standard package from ^2.0 to ^2.4
  • This brings in the latest improvements and fixes for PHP coding standards

Test plan

  • Composer dependency update is valid
  • No breaking changes expected (minor version update)

Summary by CodeRabbit

  • Chores
    • 更新开发依赖的代码规范包至最新次要版本,提升本地开发与校验一致性。
  • Refactor
    • 统一多处参数与属性的联合类型书写顺序(将 null 置于首位),保持接口一致性与可读性。
  • Documentation
    • 大量校正与统一 PHPDoc 注释(参数、返回值与属性),改进静态分析与 IDE 提示。
  • Style
    • 代码风格微调以符合最新规范要求。

说明:本次变更不涉及运行时逻辑调整与功能改动,现有 API 行为不受影响。

Updates the PHP coding standard package from ^2.0 to ^2.4 to get the latest improvements and fixes.
@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

该 PR在全仓库范围内将可空联合类型统一为“null|…”顺序,涉及PHPDoc注释、属性/参数/返回类型与少量方法签名的等价次序调整;个别构造/函数参数的联合顺序更新到 null 优先。composer.json 升级了开发依赖 huangdijia/php-coding-standard 至 ^2.4。

Changes

Cohort / File(s) Summary
Repo & CS
composer.json
升级 require-dev 中 huangdijia/php-coding-standard: ^2.0 → ^2.4。
AMQP Job
src/amqp-job/src/Functions.php
dispatch() 参数联合类型改为 null 优先;签名中 routingKey 从 string|array
Cache
src/cache/src/Contract/Repository.php, src/cache/src/Facade/Cache.php, src/cache/src/Repository.php
多处 TTL/lock 的 PHPDoc 联合类型改为 null 优先;无运行逻辑变化。
Command Signals
src/command-signals/src/SignalRegistry.php, .../Traits/InteractsWithSignals.php
unregister()/untrap() 参数联合类型改为 null 优先;签名顺序调整。
Compoships
src/compoships/src/Database/Eloquent/Concerns/HasRelationships.php, .../Relations/{BelongsTo,HasOne}.php
关系方法参数与若干返回 PHPDoc 改为 null 优先;无逻辑变更。
Config Consul
src/config-consul/src/KV.php
公共属性 $lockIndex、$flags 的联合类型顺序改为 null|int|string。
Exception Event
src/exception-event/src/{Aspect/ExceptionHandlerDispatcherAspect.php,Functions.php}
局部变量 PHPDoc 改为 null 优先。
Facades
src/facade/src/{AsyncQueue.php,Kafka.php}
@Property queue 注释改为 null|string。
gRPC Validation
src/grpc-validation/src/Annotation/ValidationAspect.php
局部变量 PHPDoc 改为 null 优先。
Helpers
src/helpers/src/Functions.php
app() 签名参数顺序 string|callable
HTTP Client
src/http-client/src/{Factory.php,PendingRequest.php,Request.php,Response.php,ResponseSequence.php}
多处属性/参数/返回的 PHPDoc 改为 null 优先;签名未变。
IDE Helper
src/ide-helper/src/Macro.php
局部变量 PHPDoc 改为 null 优先。
IPC Broadcaster
src/ipc-broadcaster/src/ServerBroadcaster.php
构造参数 PHPDoc 改为 null|int。
Lock
src/lock/src/{Annotation/BlockableAspect.php,Driver/{AbstractLock.php,CoroutineLock.php,LockInterface.php}}
注释中的可空联合与回调类型改为 null 优先;接口注释同步。
Macros(Output)
src/macros/output/Hyperf/{Collection/Arr.php,HttpServer/Contract/RequestInterface.php,Stringable/{Str.php,Stringable.php}}
多个方法签名与 PHPDoc 将联合类型改为 null 优先(含 collect/fluent 等)。
Macros(Core)
src/macros/src/ArrMixin.php
返回闭包参数联合类型改为 null 优先;实现不变。
Mail(Contracts/Core)
src/mail/src/Contract/Mailer.php, .../Mailer.php, .../Mailable/{Envelope.php,Address.php,Content.php,Headers.php}, .../Functions.php, .../Message.php
多处方法/构造/属性的联合类型顺序改为 null 优先;Mailer::send/parseView/addContent 等签名参数顺序调整为 null 优先;逻辑不变。
Model Factory
src/model-factory/src/Functions.php
返回类型 PHPDoc 改为 null 优先。
Model Hashids
src/model-hashids/src/Concerns/{HasHashid.php,HashidRouting.php}
返回/参数 PHPDoc 改为 null 优先。
Monolog Hook
src/monolog-hook/src/Aspect/UdpSocketAspect.php
@Property 注释改为 null 优先。
Notification
src/notification-mail/src/Message/MailMessage.php, src/notification/src/{DatabaseNotification.php,NotificationSender.php}
属性类型与注释改为 null 优先。
OAuth2 Server
src/oauth2-server/src/{Event/ScopeResolveEvent.php,Repository/ScopeRepository.php,Model/{AccessToken.php,AuthorizationCode.php,Device.php},Repository/UserRepository.php}
构造参数/返回签名与若干 PHPDoc 改为 null 优先;不改逻辑。
Pretty Console
src/pretty-console/src/View/Components/{Choice.php,Task.php,TwoColumnDetail.php}
方法参数 PHPDoc 改为 null 优先。
Purifier
src/purifier/src/{Casts/WithConfig.php,Functions.php,Purifier.php}
构造/方法签名与注释将 array
Redis Subscriber
src/redis-subscriber/src/{CommandBuilder.php,CommandInvoker.php}
参数与局部变量 PHPDoc 改为 null 优先。
Sentry(Core/Tracing)
src/sentry/{class_map/SentrySdk.php,src/...}
多处属性/局部变量/构造参数与 Monolog LogsHandler 构造的联合类型改为 null 优先;无行为变化。
Support
src/support/src/{Contract/HubInterface.php,Env.php,Functions.php,Number.php,Once.php,Once/Cache.php,Onceable.php,Pipeline/Hub.php,Sleep.php}
接口/属性/函数的 PHPDoc 与少量注释统一为 null 优先。
TCP Sender
src/tcp-sender/src/{PipeMessage.php,Sender.php}
返回 PHPDoc 改为 null 优先。
Telescope & ES
src/telescope-elasticsearch/src/Storage/ElasticsearchEntriesRepository.php, src/telescope/src/{Avatar.php,EntryResult.php,IncomingEntry.php,Storage/EntryQueryOptions.php,TelescopeContext.php,Aspect/GrpcCoreMiddlewareAspect.php}
多处属性/参数/返回的 PHPDoc 改为 null 优先。
Trigger
src/trigger/src/Subscriber/TriggerSubscriber.php
循环中 $payload 的 PHPDoc 改为 null 优先。
Tests
tests/Concerns/InteractsWithContainer.php
属性 PHPDoc 改为 null 优先。

Sequence Diagram(s)

(无)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

小兔叮咚敲键盘,
null 跳到队首站。
类型队形齐又整,
静态分析笑开颜。
胡萝卜做代码尺,
格式升级更好看。 🥕✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update/php-coding-standard-2.4

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 258f9e1 and ba59fba.

📒 Files selected for processing (99)
  • composer.json (1 hunks)
  • src/amqp-job/src/Functions.php (1 hunks)
  • src/cache/src/Contract/Repository.php (4 hunks)
  • src/cache/src/Facade/Cache.php (4 hunks)
  • src/cache/src/Repository.php (1 hunks)
  • src/command-signals/src/SignalRegistry.php (1 hunks)
  • src/command-signals/src/Traits/InteractsWithSignals.php (1 hunks)
  • src/compoships/src/Database/Eloquent/Concerns/HasRelationships.php (3 hunks)
  • src/compoships/src/Database/Eloquent/Relations/BelongsTo.php (1 hunks)
  • src/compoships/src/Database/Eloquent/Relations/HasOne.php (1 hunks)
  • src/config-consul/src/KV.php (1 hunks)
  • src/exception-event/src/Aspect/ExceptionHandlerDispatcherAspect.php (1 hunks)
  • src/exception-event/src/Functions.php (1 hunks)
  • src/facade/src/AsyncQueue.php (1 hunks)
  • src/facade/src/Kafka.php (1 hunks)
  • src/grpc-validation/src/Annotation/ValidationAspect.php (1 hunks)
  • src/helpers/src/Functions.php (10 hunks)
  • src/http-client/src/Factory.php (4 hunks)
  • src/http-client/src/PendingRequest.php (11 hunks)
  • src/http-client/src/Request.php (1 hunks)
  • src/http-client/src/Response.php (7 hunks)
  • src/http-client/src/ResponseSequence.php (1 hunks)
  • src/ide-helper/src/Macro.php (1 hunks)
  • src/ipc-broadcaster/src/ServerBroadcaster.php (1 hunks)
  • src/lock/src/Annotation/BlockableAspect.php (1 hunks)
  • src/lock/src/Driver/AbstractLock.php (1 hunks)
  • src/lock/src/Driver/CoroutineLock.php (1 hunks)
  • src/lock/src/Driver/LockInterface.php (2 hunks)
  • src/macros/output/Hyperf/Collection/Arr.php (5 hunks)
  • src/macros/output/Hyperf/HttpServer/Contract/RequestInterface.php (4 hunks)
  • src/macros/output/Hyperf/Stringable/Str.php (1 hunks)
  • src/macros/output/Hyperf/Stringable/Stringable.php (1 hunks)
  • src/macros/src/ArrMixin.php (5 hunks)
  • src/mail/src/Contract/Mailer.php (1 hunks)
  • src/mail/src/Functions.php (1 hunks)
  • src/mail/src/Mailable/Address.php (1 hunks)
  • src/mail/src/Mailable/Content.php (4 hunks)
  • src/mail/src/Mailable/Envelope.php (8 hunks)
  • src/mail/src/Mailable/Headers.php (1 hunks)
  • src/mail/src/Mailer.php (3 hunks)
  • src/mail/src/Message.php (3 hunks)
  • src/model-factory/src/Functions.php (1 hunks)
  • src/model-hashids/src/Concerns/HasHashid.php (3 hunks)
  • src/model-hashids/src/Concerns/HashidRouting.php (1 hunks)
  • src/monolog-hook/src/Aspect/UdpSocketAspect.php (1 hunks)
  • src/notification-mail/src/Message/MailMessage.php (1 hunks)
  • src/notification/src/DatabaseNotification.php (1 hunks)
  • src/notification/src/NotificationSender.php (1 hunks)
  • src/oauth2-server/src/Event/ScopeResolveEvent.php (2 hunks)
  • src/oauth2-server/src/Model/AccessToken.php (1 hunks)
  • src/oauth2-server/src/Model/AuthorizationCode.php (1 hunks)
  • src/oauth2-server/src/Model/Device.php (1 hunks)
  • src/oauth2-server/src/Repository/ScopeRepository.php (1 hunks)
  • src/oauth2-server/src/Repository/UserRepository.php (1 hunks)
  • src/pretty-console/src/View/Components/Choice.php (1 hunks)
  • src/pretty-console/src/View/Components/Task.php (1 hunks)
  • src/pretty-console/src/View/Components/TwoColumnDetail.php (1 hunks)
  • src/purifier/src/Casts/WithConfig.php (1 hunks)
  • src/purifier/src/Functions.php (1 hunks)
  • src/purifier/src/Purifier.php (3 hunks)
  • src/redis-subscriber/src/CommandBuilder.php (1 hunks)
  • src/redis-subscriber/src/CommandInvoker.php (2 hunks)
  • src/sentry/class_map/SentrySdk.php (1 hunks)
  • src/sentry/src/Aspect/BreadcrumbAspect.php (1 hunks)
  • src/sentry/src/Aspect/LoggerAspect.php (1 hunks)
  • src/sentry/src/Factory/HubFactory.php (1 hunks)
  • src/sentry/src/Integration/RequestFetcher.php (1 hunks)
  • src/sentry/src/Integration/RequestIntegration.php (1 hunks)
  • src/sentry/src/Monolog/LogsHandler.php (1 hunks)
  • src/sentry/src/Tracing/Aspect/AmqpProducerAspect.php (2 hunks)
  • src/sentry/src/Tracing/Aspect/AsyncQueueJobMessageAspect.php (1 hunks)
  • src/sentry/src/Tracing/Aspect/RpcAspect.php (1 hunks)
  • src/sentry/src/Tracing/Aspect/TraceAnnotationAspect.php (1 hunks)
  • src/sentry/src/Tracing/Listener/TracingAmqpListener.php (2 hunks)
  • src/sentry/src/Tracing/Listener/TracingAsyncQueueListener.php (2 hunks)
  • src/sentry/src/Tracing/Listener/TracingKafkaListener.php (1 hunks)
  • src/sentry/src/Tracing/SpanStarter.php (1 hunks)
  • src/sentry/src/Transport/CoHttpTransport.php (1 hunks)
  • src/sentry/src/Util/SafeCaller.php (1 hunks)
  • src/support/src/Contract/HubInterface.php (1 hunks)
  • src/support/src/Env.php (1 hunks)
  • src/support/src/Functions.php (1 hunks)
  • src/support/src/Number.php (1 hunks)
  • src/support/src/Once.php (1 hunks)
  • src/support/src/Once/Cache.php (1 hunks)
  • src/support/src/Onceable.php (3 hunks)
  • src/support/src/Pipeline/Hub.php (1 hunks)
  • src/support/src/Sleep.php (1 hunks)
  • src/tcp-sender/src/PipeMessage.php (1 hunks)
  • src/tcp-sender/src/Sender.php (1 hunks)
  • src/telescope-elasticsearch/src/Storage/ElasticsearchEntriesRepository.php (1 hunks)
  • src/telescope/src/Aspect/GrpcCoreMiddlewareAspect.php (2 hunks)
  • src/telescope/src/Avatar.php (2 hunks)
  • src/telescope/src/EntryResult.php (1 hunks)
  • src/telescope/src/IncomingEntry.php (1 hunks)
  • src/telescope/src/Storage/EntryQueryOptions.php (1 hunks)
  • src/telescope/src/TelescopeContext.php (1 hunks)
  • src/trigger/src/Subscriber/TriggerSubscriber.php (1 hunks)
  • tests/Concerns/InteractsWithContainer.php (1 hunks)

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.17)

At least one path must be specified to analyse.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Reorders union types to follow null-first convention and applies other
code style improvements as required by the updated huangdijia/php-coding-standard package.

This commit includes automatic fixes across multiple components:
- Union type reordering (Type|null → null|Type)
- Consistent formatting and style improvements
- No functional changes, only code style compliance
@huangdijia huangdijia merged commit 13ce1ac into main Sep 19, 2025
15 of 16 checks passed
@huangdijia huangdijia deleted the update/php-coding-standard-2.4 branch September 19, 2025 13:07
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.

2 participants