jakubkulhan / bunny

Performant pure-PHP AMQP (RabbitMQ) sync/async (ReactPHP) library
MIT License
698 stars 101 forks source link

Replace `elseif`s with early returns in `Connection` #153

Closed jeromegamez closed 3 months ago

jeromegamez commented 3 months ago

This PR proposes replacing all elseif branches in the generated Connection class with early returns.

This is in preparation for #152, which has the primary goal of removing a duplicate check

https://github.com/jakubkulhan/bunny/blob/873ec47e7e3f68c39e4895d249fbe8a1773b68eb/src/Connection.php#L342-L347

The problem there is that this requires removing an if branch and converting an elseif branch to an if branch.

Removing elseif branches in the first place will make this a lot easier.

:octocat: