public function prepareOutput($output, $strict = false)
    {
        if ($strict && version_compare(PHP_VERSION, '7') < 1) {
            throw new RuntimeException('Strict mode requires PHP 7 or greater.');
        }

        $dir = dirname($output);

        if (!is_dir($dir) && !mkdir($dir, 0777, true)) {
            throw new RuntimeException("Unable to create directory $dir.");
        }

        $handle = fopen($output, 'w');

        if (!$handle) {
            throw new RuntimeException("Unable to open $output for writing.");
        }

        if ($strict) {
            fwrite($handle, "<?php declare(strict_types=1);\n");
        } else {
            fwrite($handle, "<?php\n");
        }

        return $handle;
    }
public function prepareOutput($output, $strict = false)
    {
        if ($strict && version_compare(PHP_VERSION, '7') < 1) {
            throw new RuntimeException('Strict mode requires PHP 7 or greater.');
        }

        $dir = dirname($output);

        if (!is_dir($dir) && !mkdir($dir, 0777, true)) {
            throw new RuntimeException("Unable to create directory $dir.");
        }

        $handle = fopen($output, 'w');

        if (!$handle) {
            throw new RuntimeException("Unable to open $output for writing.");
        }

        if ($strict) {
            fwrite($handle, "<?php declare(strict_types=1);\n");
        } else {
            fwrite($handle, "<?php\n");
        }

        return $handle;
    }
public function prepareOutput ( $ output , $ strict = false ) { if ( $ strict && version_compare ( PHP_VERSION , '7' ) < 1 ) { throw new RuntimeException ( 'Strict mode requires PHP 7 or greater.' ) ; } $ dir = dirname ( $ output ) ; if ( ! is_dir ( $ dir ) && ! mkdir ( $ dir , 0777 , true ) ) { throw new RuntimeException ( "Unable to create directory $dir." ) ; } $ handle = fopen ( $ output , 'w' ) ; if ( ! $ handle ) { throw new RuntimeException ( "Unable to open $output for writing." ) ; } if ( $ strict ) { fwrite ( $ handle , "<?php declare(strict_types=1);\n" ) ; } else { fwrite ( $ handle , "<?php\n" ) ; } return $ handle ; }
Prepare the output file and directory.

@param string $output
@param bool   $strict

@throws \RuntimeException

@return resource
Prepare the output file and directory .