dg / bypass-finals

Removes `final` and `readonly` keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit or Mockery.
Other
487 stars 30 forks source link

TypeError : mkdir() expects parameter 4 to be resource, null given #21

Closed k0pernikus closed 4 years ago

k0pernikus commented 4 years ago

I have included it inside a php@7.1 project in order to mock a final class. Yet a test is now breaking due to:

TypeError : mkdir() expects parameter 4 to be resource, null given
 /opt/project/vendor/dg/bypass-finals/src/BypassFinals.php:220
 /opt/project/vendor/dg/bypass-finals/src/BypassFinals.php:71
    public function mkdir(string $path, int $mode, int $options): bool
    {
        $recursive = (bool) ($options & STREAM_MKDIR_RECURSIVE);
        return $this->native('mkdir', $path, $mode, $recursive, $this->context);
    }

The project uses ZipARchive and it fails when trying to execute an zip folder via: extractTo.

Why would bypass-finals break here?