Skip to content

(HW-20) Проектирование API#749

Open
vals07 wants to merge 1 commit into
abuglova/mainfrom
abuglova/hw20
Open

(HW-20) Проектирование API#749
vals07 wants to merge 1 commit into
abuglova/mainfrom
abuglova/hw20

Conversation

@vals07

@vals07 vals07 commented May 22, 2026

Copy link
Copy Markdown

No description provided.

) {
$this->connection = new AMQPStreamConnection($host, $port, $user, $password);
$this->channel = $this->connection->channel();
$this->channel->queue_declare($this->queueName, false, true, false, false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

В таких случаях лучше использовать named arguments, чтобы не вспоминать, какой true/false за что отвечает, например

$this->channel->queue_declare(
  name: $this->queueName, 
  passive: false, 
  durable: true, 
  exclusive: false, 
  auto_delete: false
);

На работоспособность кода, само собой, это не влияет. Но в реальной практике очень упрощает чтение как ревьюерам, так и самому автору через пару месяцев

(string) $row['created_at'],
(string) $row['updated_at'],
$row['processed_at'] === null ? null : (string) $row['processed_at'],
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Подобное же (именованные аргументы) можно использовать и здесь.

*/
final class RequestController
{
private readonly RequestService $service;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Если все поля readonly, то можно смело делать сам класс readonly

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