Skip to content

Conversation

tomas-novotny
Copy link
Contributor

@tomas-novotny tomas-novotny commented Feb 21, 2025

Better code style with phpcbf and rector tools.

  • add param and return types everywhere
  • add missing visibility
  • replace " -> '
  • fix imports
  • updated spec/generate.php to match generated code with code style format.

Cleanup composer dependencies with composer-dependency-analyser

Updated phpstan/phpstan: ^2.0 with raised level to 5 -> 7

  • add better typehints to callable, array, promises, etc.
-/** @var callable[] */
+/** @var list<callable(\Bunny\Message, \Bunny\Protocol\MethodBasicReturnFrame): void> */
private array $returnCallbacks = [];
  • fix return types of generated methods (remove bool if method never returns it)
-public function qos(int $prefetchSize = 0, int $prefetchCount = 0, bool $global = false): bool|Protocol\MethodBasicQosOkFrame
+public function qos(int $prefetchSize = 0, int $prefetchCount = 0, bool $global = false): Protocol\MethodBasicQosOkFrame
  • add missing methods to ClientInterface
+public function exchangeDeclare(string $exchange, string $exchangeType = 'direct', bool $passive = false, bool $durable = false, bool $autoDelete = false, bool $internal = false, bool $nowait = false, array $arguments = []): bool|Protocol\MethodExchangeDeclareOkFrame;
+public function exchangeDelete(string $exchange, bool $ifUnused = false, bool $nowait = false): bool|MethodExchangeDeleteOkFrame;
+public function exchangeBind(string $destination, string $source, string $routingKey = '', bool $nowait = false, array $arguments = []): bool|MethodExchangeBindOkFrame;
+public function exchangeUnbind(string $destination, string $source, string $routingKey = '', bool $nowait = false, array $arguments = []): bool|MethodExchangeUnbindOkFrame;
+public function recoverAsync(bool $requeue = false): bool;
+public function recover(bool $requeue = false): bool|MethodBasicRecoverOkFrame;
  • remove getOkFrame and getDeferred from Channel - it was never used, removed in b295581
-private ?MethodBasicGetOkFrame $getOkFrame = null;
-private ?Deferred $getDeferred = null;

@WyriHaximus WyriHaximus added this to the v0.6.0 milestone Mar 10, 2025
@WyriHaximus
Copy link
Collaborator

image

Copy link
Collaborator

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

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

The changes themself look good. But you mentioned you use phpcbf and rector to do the automated parts of the work. Can you add those to composer.json and commit their configs as well so we can use that in the future while working on Bunny?

Copy link
Collaborator

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

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

Amazing start, thank you for the work you put into this massive PR :shipit:

@WyriHaximus WyriHaximus merged commit 3f43b51 into jakubkulhan:0.6.x Mar 10, 2025
110 checks passed
@tomas-novotny tomas-novotny deleted the 0.6.x-cs branch March 20, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants