<?php

/** @generate-class-entries */

class PharException extends Exception
{
}

class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
{
    /**
     * @cvalue PHAR_ENT_COMPRESSED_BZ2
     */
    const int BZ2 = UNKNOWN;
    /**
     * @cvalue PHAR_ENT_COMPRESSED_GZ
     */
    const int GZ = UNKNOWN;
    /**
     * @cvalue PHAR_ENT_COMPRESSED_NONE
     */
    const int NONE = UNKNOWN;
    /**
     * @cvalue PHAR_FORMAT_PHAR
     */
    const int PHAR = UNKNOWN;
    /**
     * @cvalue PHAR_FORMAT_TAR
     */
    const int TAR = UNKNOWN;
    /**
     * @cvalue PHAR_FORMAT_ZIP
     */
    const int ZIP = UNKNOWN;
    /**
     * @cvalue PHAR_ENT_COMPRESSION_MASK
     */
    const int COMPRESSED = UNKNOWN;
    /**
     * @cvalue PHAR_MIME_PHP
     */
    const int PHP = UNKNOWN;
    /**
     * @cvalue PHAR_MIME_PHPS
     */
    const int PHPS = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_MD5
     */
    const int MD5 = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_OPENSSL
     */
    const int OPENSSL = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_OPENSSL_SHA256
     */
    const int OPENSSL_SHA256 = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_OPENSSL_SHA512
     */
    const int OPENSSL_SHA512 = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_SHA1
     */
    const int SHA1 = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_SHA256
     */
    const int SHA256 = UNKNOWN;
    /**
     * @cvalue PHAR_SIG_SHA512
     */
    const int SHA512 = UNKNOWN;

    public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null) {}

    public function __destruct() {}

    /** @tentative-return-type */
    public function addEmptyDir(string $directory): void {}

    /** @tentative-return-type */
    public function addFile(string $filename, ?string $localName = null): void {}

    /** @tentative-return-type */
    public function addFromString(string $localName, string $contents): void {}

    /** @tentative-return-type */
    public function buildFromDirectory(string $directory, string $pattern = ""): array {}

    /** @tentative-return-type */
    public function buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array {}

    /** @tentative-return-type */
    public function compressFiles(int $compression): void {}

    /** @tentative-return-type */
    public function decompressFiles(): true {}

    /** @tentative-return-type */
    public function compress(int $compression, ?string $extension = null): ?Phar {}

    /** @tentative-return-type */
    public function decompress(?string $extension = null): ?Phar {}

    /** @tentative-return-type */
    public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar {}

    /** @tentative-return-type */
    public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData {}

    /** @tentative-return-type */
    public function copy(string $from, string $to): true {}

    /** @tentative-return-type */
    public function count(int $mode = COUNT_NORMAL): int {}

    /** @tentative-return-type */
    public function delete(string $localName): true {}

    /** @tentative-return-type */
    public function delMetadata(): true {}

    /** @tentative-return-type */
    public function extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool {}

    /** @tentative-return-type */
    public function getAlias(): ?string {}

    /** @tentative-return-type */
    public function getPath(): string {}

    /** @tentative-return-type */
    public function getMetadata(array $unserializeOptions = []): mixed {}

    /** @tentative-return-type */
    public function getModified(): bool {}

    /** @tentative-return-type */
    public function getSignature(): array|false {}

    /** @tentative-return-type */
    public function getStub(): string {}

    /** @tentative-return-type */
    public function getVersion(): string {}

    /** @tentative-return-type */
    public function hasMetadata(): bool {}

    /** @tentative-return-type */
    public function isBuffering(): bool {}

    /** @tentative-return-type */
    public function isCompressed(): int|false {}

    /** @tentative-return-type */
    public function isFileFormat(int $format): bool {}

    /** @tentative-return-type */
    public function isWritable(): bool {}

    /**
     * @param string $localName
     * @tentative-return-type
     */
    public function offsetExists($localName): bool {}

    /**
     * @param string $localName
     * @tentative-return-type
     */
    public function offsetGet($localName): SplFileInfo {}

    /**
     * @param string $localName
     * @param resource|string $value
     * @tentative-return-type
     */
    public function offsetSet($localName, $value): void {}

    /**
     * @param string $localName
     * @tentative-return-type
     */
    public function offsetUnset($localName): void {}

    /** @tentative-return-type */
    public function setAlias(string $alias): true {}

    /** @tentative-return-type */
    public function setDefaultStub(?string $index = null, ?string $webIndex = null): true {}

    /** @tentative-return-type */
    public function setMetadata(mixed $metadata): void {}

    /** @tentative-return-type */
    public function setSignatureAlgorithm(int $algo, ?string $privateKey = null): void {}

    /**
     * @param resource|string $stub
     * @tentative-return-type
     */
    public function setStub($stub, int $length = UNKNOWN): true {}

    /** @tentative-return-type */
    public function startBuffering(): void {}

    /** @tentative-return-type */
    public function stopBuffering(): void {}

    final public static function apiVersion(): string {}

    final public static function canCompress(int $compression = 0): bool {}

    final public static function canWrite(): bool {}

    final public static function createDefaultStub(?string $index = null, ?string $webIndex = null): string {}

    final public static function getSupportedCompression(): array {}

    final public static function getSupportedSignatures(): array {}

    final public static function interceptFileFuncs(): void {}

    final public static function isValidPharFilename(string $filename, bool $executable = true): bool {}

    final public static function loadPhar(string $filename, ?string $alias = null): bool {}

    final public static function mapPhar(?string $alias = null, int $offset = 0): bool {}

    final public static function running(bool $returnPhar = true): string {}

    final public static function mount(string $pharPath, string $externalPath): void {}

    final public static function mungServer(array $variables): void {}

    final public static function unlinkArchive(string $filename): true {}

    final public static function webPhar(
        ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
        array $mimeTypes = [], ?callable $rewrite = null): void {}
}

class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
{
    /** @implementation-alias Phar::__construct */
    public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, int $format = 0) {}

    /** @implementation-alias Phar::__destruct */
    public function __destruct() {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::addEmptyDir
     */
    public function addEmptyDir(string $directory): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::addFile
     */
    public function addFile(string $filename, ?string $localName = null): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::addFromString
     */
    public function addFromString(string $localName, string $contents): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::buildFromDirectory
     */
    public function buildFromDirectory(string $directory, string $pattern = ""): array {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::buildFromIterator
     */
    public function buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::compressFiles
     */
    public function compressFiles(int $compression): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::decompressFiles
     */
    public function decompressFiles(): true {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::compress
     */
    public function compress(int $compression, ?string $extension = null): ?PharData {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::decompress
     */
    public function decompress(?string $extension = null): ?PharData {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::convertToExecutable
     */
    public function convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::convertToData
     */
    public function convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::copy
     */
    public function copy(string $from, string $to): true {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::count
     */
    public function count(int $mode = COUNT_NORMAL): int {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::delete
     */
    public function delete(string $localName): true {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::delMetadata
     */
    public function delMetadata(): true {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::extractTo
     */
    public function extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getAlias
     */
    public function getAlias(): ?string {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getPath
     */
    public function getPath(): string {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getMetadata
     */
    public function getMetadata(array $unserializeOptions = []): mixed {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getModified
     */
    public function getModified(): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getSignature
     */
    public function getSignature(): array|false {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getStub
     */
    public function getStub(): string {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::getVersion
     */
    public function getVersion(): string {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::hasMetadata
     */
    public function hasMetadata(): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::isBuffering
     */
    public function isBuffering(): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::isCompressed
     */
    public function isCompressed(): int|false {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::isFileFormat
     */
    public function isFileFormat(int $format): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::isWritable
     */
    public function isWritable(): bool {}

    /**
     * @param string $localName
     * @tentative-return-type
     * @implementation-alias Phar::offsetExists
     */
    public function offsetExists($localName): bool {}

    /**
     * @param string $localName
     * @tentative-return-type
     * @implementation-alias Phar::offsetGet
     */
    public function offsetGet($localName): SplFileInfo {}

    /**
     * @param string $localName
     * @param resource|string $value
     * @tentative-return-type
     * @implementation-alias Phar::offsetSet
     */
    public function offsetSet($localName, $value): void {}

    /**
     * @param string $localName
     * @tentative-return-type
     * @implementation-alias Phar::offsetUnset
     */
    public function offsetUnset($localName): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::setAlias
     */
    public function setAlias(string $alias): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::setDefaultStub
     */
    public function setDefaultStub(?string $index = null, ?string $webIndex = null): bool {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::setMetadata
     */
    public function setMetadata(mixed $metadata): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::setSignatureAlgorithm
     */
    public function setSignatureAlgorithm(int $algo, ?string $privateKey = null): void {}

    /**
     * @param resource|string $stub
     * @implementation-alias Phar::setStub
     */
    public function setStub($stub, int $length = UNKNOWN): true {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::startBuffering
     */
    public function startBuffering(): void {}

    /**
     * @tentative-return-type
     * @implementation-alias Phar::stopBuffering
     */
    public function stopBuffering(): void {}

    /** @implementation-alias Phar::apiVersion */
    final public static function apiVersion(): string {}

    /** @implementation-alias Phar::canCompress */
    final public static function canCompress(int $compression = 0): bool {}

    /** @implementation-alias Phar::canWrite */
    final public static function canWrite(): bool {}

    /** @implementation-alias Phar::createDefaultStub */
    final public static function createDefaultStub(?string $index = null, ?string $webIndex = null): string {}

    /** @implementation-alias Phar::getSupportedCompression */
    final public static function getSupportedCompression(): array {}

    /** @implementation-alias Phar::getSupportedSignatures */
    final public static function getSupportedSignatures(): array {}

    /** @implementation-alias Phar::interceptFileFuncs */
    final public static function interceptFileFuncs(): void {}

    /** @implementation-alias Phar::isValidPharFilename */
    final public static function isValidPharFilename(string $filename, bool $executable = true): bool {}

    /** @implementation-alias Phar::loadPhar */
    final public static function loadPhar(string $filename, ?string $alias = null): bool {}

    /** @implementation-alias Phar::mapPhar */
    final public static function mapPhar(?string $alias = null, int $offset = 0): bool {}

    /** @implementation-alias Phar::running */
    final public static function running(bool $returnPhar = true): string {}

    /** @implementation-alias Phar::mount */
    final public static function mount(string $pharPath, string $externalPath): void {}

    /** @implementation-alias Phar::mungServer */
    final public static function mungServer(array $variables): void {}

    /** @implementation-alias Phar::unlinkArchive */
    final public static function unlinkArchive(string $filename): true {}

    /** @implementation-alias Phar::webPhar */
    final public static function webPhar(
        ?string $alias = null, ?string $index = null, ?string $fileNotFoundScript = null,
        array $mimeTypes = [], ?callable $rewrite = null): void {}
}

class PharFileInfo extends SplFileInfo
{
    public function __construct(string $filename) {}

    public function __destruct() {}

    /** @tentative-return-type */
    public function chmod(int $perms): void {}

    /** @tentative-return-type */
    public function compress(int $compression): true {}

    /** @tentative-return-type */
    public function decompress(): true {}

    /** @tentative-return-type */
    public function delMetadata(): true {}

    /** @tentative-return-type */
    public function getCompressedSize(): int {}

    /** @tentative-return-type */
    public function getCRC32(): int {}

    /** @tentative-return-type */
    public function getContent(): string {}

    /** @tentative-return-type */
    public function getMetadata(array $unserializeOptions = []): mixed {}

    /** @tentative-return-type */
    public function getPharFlags(): int {}

    /** @tentative-return-type */
    public function hasMetadata(): bool {}

    /** @tentative-return-type */
    public function isCompressed(?int $compression = null): bool {}

    /** @tentative-return-type */
    public function isCRCChecked(): bool {}

    /** @tentative-return-type */
    public function setMetadata(mixed $metadata): void {}
}
