Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Changes file mode
<?php chmod(string $filename, int $permissions): bool
<?php     protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)

    {

        $io = $this->getIO();

        @chmod($newFilename, fileperms($localFilename));




        if (!$this->validatePhar($newFilename, $error)) {
<?php             if ($originIsLocal) {


                @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));



                if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {

                    throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
<?php     public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)

    {

        foreach ($this->toIterable($files) as $file) {

            if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && true !== @chmod($file, $mode & ~$umask)) {

                throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);

            }

            if ($recursive && is_dir($file) && !is_link($file)) {
<?php                 throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);

            }



            @chmod($tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());



            $this->rename($tmpFile, $filename, true);

        } finally {