sebastianbergmann / exporter

Provides the functionality to export PHP variables for visualization
BSD 3-Clause "New" or "Revised" License
6.77k stars 34 forks source link

Improve export of closed resources #36

Closed jrfnl closed 3 years ago

jrfnl commented 3 years ago

Given the following code:

use SebastianBergmann\Exporter\Exporter;

include __DIR__ . '/vendor/autoload.php';

$exporter = new Exporter;

$dir = opendir( __DIR__ );
echo $exporter->export($dir), PHP_EOL;

closedir($dir);
echo $exporter->export($dir), PHP_EOL;

... the output would be along the lines of:

resource(11) of type (stream)
NULL

... which when used in a PHPUnit error message results is something along the lines of:

Failed asserting that NULL is not of type "boolean"

I'd like to suggest reporting closed resources as resource (closed) instead of NULL.

jrfnl commented 3 years ago

(PR upcoming)

jrfnl commented 3 years ago

As both PRs have now been merged and the 4.x branch merged to master, I think this issue can be closed ?