Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Shift an element off the beginning of array
<?php array_shift(array &$array): mixed
<?php     public function check($resolve, $reject)

    {

        $ip = \array_shift($this->connectQueue);




        $this->connectionPromises[] = $this->attemptConnection($ip);
<?php         $this->connectQueue = array();

        while (\count($connectQueueStash) > 0 || \count($ips) > 0) {

            if (\count($ips) > 0) {

                $this->connectQueue[] = \array_shift($ips);

            }

            if (\count($connectQueueStash) > 0) {

                $this->connectQueue[] = \array_shift($connectQueueStash);
<?php                 $this->connectQueue[] = \array_shift($ips);

            }

            if (\count($connectQueueStash) > 0) {

                $this->connectQueue[] = \array_shift($connectQueueStash);

            }

        }

    }
<?php             new Promise\Promise(function () {}, $this->expectCallableNever()),

        );

        $this->resolver->expects($this->exactly(2))->method('resolveAll')->with($this->equalTo('example.com'), $this->anything())->will($this->returnCallback(function () use (&$lookupAttempts) {

            return array_shift($lookupAttempts);

        }));

        $this->tcp->expects($this->exactly(2))->method('connect')->with($this->isType('string'))->will($this->returnCallback(function () use (&$connectionAttempts) {

            return array_shift($connectionAttempts);
<?php             return array_shift($lookupAttempts);

        }));

        $this->tcp->expects($this->exactly(2))->method('connect')->with($this->isType('string'))->will($this->returnCallback(function () use (&$connectionAttempts) {

            return array_shift($connectionAttempts);

        }));



        $promise = $this->connector->connect('example.com:80');