Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Finds whether a variable is a resource
<?php is_resource(mixed $value): bool
<?php     public function handleClose()

    {

        if (!\is_resource($this->stream)) {

            return;

        }
<?php     public function getRemoteAddress()

    {

        if (!\is_resource($this->stream)) {

            return null;

        }
<?php     public function getLocalAddress()

    {

        if (!\is_resource($this->stream)) {

            return null;

        }
<?php     public function getAddress()

    {

        if (!\is_resource($this->master)) {

            return null;

        }
<?php     public function resume()

    {

        if ($this->listening || !\is_resource($this->master)) {

            return;

        }
<?php     public function close()

    {

        if (!\is_resource($this->master)) {

            return;

        }
<?php             if (\PHP_VERSION_ID < 50400 && \is_resource($stream)) {

                \fclose($stream);

            }
<?php     public function getAddress()

    {

        if (!\is_resource($this->master)) {

            return null;

        }
<?php     public function resume()

    {

        if ($this->listening || !\is_resource($this->master)) {

            return;

        }
<?php     public function close()

    {

        if (!\is_resource($this->master)) {

            return;

        }
<?php     public function getAddress()

    {

        if (!\is_resource($this->master)) {

            return null;

        }
<?php     public function resume()

    {

        if ($this->listening || !is_resource($this->master)) {

            return;

        }
<?php     public function close()

    {

        if (!\is_resource($this->master)) {

            return;

        }
<?php         $connection = new Connection($resource, $loop);

        $connection->close();



        $this->assertFalse(is_resource($resource));

    }



    public function testCloseConnectionWillRemoveResourceFromLoopBeforeClosingResource()
<?php         $onRemove = null;

        $loop->expects($this->once())->method('removeWriteStream')->with($this->callback(function ($param) use (&$onRemove) {

            $onRemove = is_resource($param);

            return true;

        }));