Skip to content

Commit

Permalink
Merge pull request #6 from artem-yakymchuk-paysera/php7-compatibility
Browse files Browse the repository at this point in the history
Use rector to update code standarts to support php 7
  • Loading branch information
PayseraGithub authored Mar 20, 2024
2 parents 3fc2f74 + 41c4cd9 commit bcc5cd2
Show file tree
Hide file tree
Showing 2,121 changed files with 38,644 additions and 172,115 deletions.
2 changes: 1 addition & 1 deletion Archive/docs/tutorial_autoload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$dir = dirname( __FILE__ );
$dir = __DIR__;
$dirParts = explode( DIRECTORY_SEPARATOR, $dir );
switch ( $dirParts[count( $dirParts ) - 3] )
{
Expand Down
2 changes: 1 addition & 1 deletion Archive/docs/tutorial_read_only.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require_once 'tutorial_autoload.php';

$options = new ezcArchiveOptions( array( 'readOnly' => true ) );
$options = new ezcArchiveOptions( ['readOnly' => true] );
$archive = ezcArchive::open(
"compress.zlib:///tmp/my_archive.tar.gz", null, $options );

Expand Down
4 changes: 2 additions & 2 deletions Archive/docs/tutorial_recursive.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ function findRecursiveCallback( ezcBaseFileFindContext $context, $sourceDir, $fi
{
$path .= '/';
}
$context->archive->append( array( $path ), $context->prefix );
$context->archive->append( [$path], $context->prefix );
}

function appendRecursive( $archive, $sourceDir, $prefix )
{
$context = new ArchiveContext();
$context->archive = $archive;
$context->prefix = $prefix;
ezcBaseFile::walkRecursive( $sourceDir, array(), array(), 'findRecursiveCallback', $context );
ezcBaseFile::walkRecursive( $sourceDir, [], [], 'findRecursiveCallback', $context );
}

$archive = ezcArchive::open( "my_archive.zip", ezcArchive::ZIP );
Expand Down
20 changes: 10 additions & 10 deletions Archive/src/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,42 +62,42 @@ abstract class ezcArchive implements Iterator
/**
* Normal tar archive.
*/
const TAR = 0;
public const TAR = 0;

/**
* Tar version 7 archive.
*/
const TAR_V7 = 1;
public const TAR_V7 = 1;

/**
* USTAR tar archive.
*/
const TAR_USTAR = 2;
public const TAR_USTAR = 2;

/**
* PAX tar archive.
*/
const TAR_PAX = 3;
public const TAR_PAX = 3;

/**
* GNU tar archive.
*/
const TAR_GNU = 4;
public const TAR_GNU = 4;

/**
* ZIP archive.
*/
const ZIP = 10;
public const ZIP = 10;

/**
* Gnu ZIP compression format.
*/
const GZIP = 20;
public const GZIP = 20;

/**
* BZIP2 compression format.
*/
const BZIP2 = 30;
public const BZIP2 = 30;

/**
* The entry or file number to which the iterator points.
Expand Down Expand Up @@ -835,7 +835,7 @@ public function getListing()
throw new ezcArchiveException( "The archive is closed" );
}

$result = array();
$result = [];
$this->rewind();

do
Expand Down Expand Up @@ -932,7 +932,7 @@ protected function getEntries( $files, $prefix )
{
if ( !is_array( $files ) )
{
$files = array( $files );
$files = [$files];
}

// Check whether the files are correct.
Expand Down
20 changes: 10 additions & 10 deletions Archive/src/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,42 @@ class ezcArchiveEntry
/**
* Is a regular file.
*/
const IS_FILE = 0;
public const IS_FILE = 0;

/**
* Is a hard link.
*/
const IS_LINK = 1;
public const IS_LINK = 1;

/**
* Is a symbolic link.
*/
const IS_SYMBOLIC_LINK = 2;
public const IS_SYMBOLIC_LINK = 2;

/**
* Is a character device.
*/
const IS_CHARACTER_DEVICE = 3;
public const IS_CHARACTER_DEVICE = 3;

/**
* Is a block device.
*/
const IS_BLOCK_DEVICE = 4;
public const IS_BLOCK_DEVICE = 4;

/**
* Is a directory.
*/
const IS_DIRECTORY = 5;
public const IS_DIRECTORY = 5;

/**
* Is a FIFO.
*/
const IS_FIFO = 6;
public const IS_FIFO = 6;

/**
* Not used, is Tar specific?
*/
const IS_RESERVED = 7;
public const IS_RESERVED = 7;

/**
* Contains the file information.
Expand Down Expand Up @@ -557,10 +557,10 @@ public static function getEntryFromFile( $files, $prefix )
if ( !is_array( $files ) )
{
$isArray = false;
$files = array( $files );
$files = [$files];
}

$inodes = array();
$inodes = [];
$i = 0;
foreach ( $files as $file )
{
Expand Down
2 changes: 1 addition & 1 deletion Archive/src/exceptions/value.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ezcArchiveValueException extends ezcArchiveException
public function __construct( $value, $expectedValue = null )
{
$type = gettype( $value );
if ( in_array( $type, array( 'array', 'object', 'resource' ) ) )
if ( in_array( $type, ['array', 'object', 'resource'] ) )
{
$value = serialize( $value );
}
Expand Down
12 changes: 6 additions & 6 deletions Archive/src/file/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ abstract class ezcArchiveFile implements Iterator
* The file permissions can be set to read-only or file is compressed with a
* stream that can only be read. E.g. bzip2.
*/
const READ_ONLY = 1;
public const READ_ONLY = 1;

/**
* The file is write-only.
* The file permissions can be set to write-only or file should be compressed with a
* stream that can only write. E.g. bzip2.
*/
const WRITE_ONLY = 2;
public const WRITE_ONLY = 2;

/**
* The file is either read or append mode.
* Some compressed streams (zlib) do not support reading and writing. But seperate reading
* and appending does work.
*/
const READ_APPEND = 3;
public const READ_APPEND = 3;

/**
* The file is opened in a read and write mode.
*/
const READ_WRITE = 4;
public const READ_WRITE = 4;

/**
* The mode the file is opened in. It has one of the following constant values:
Expand Down Expand Up @@ -93,12 +93,12 @@ abstract class ezcArchiveFile implements Iterator
/**
* Read-mode for the archive file.
*/
const SWITCH_READ = 0;
public const SWITCH_READ = 0;

/**
* Append-mode for the archive file.
*/
const SWITCH_APPEND = 1;
public const SWITCH_APPEND = 1;

/**
* Switch for read-mode and append-mode.
Expand Down
2 changes: 1 addition & 1 deletion Archive/src/options/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ezcArchiveOptions extends ezcBaseOptions
* if $options contains a property with a value not allowed
* @param array(string=>mixed) $options
*/
public function __construct( array $options = array() )
public function __construct( array $options = [] )
{
$this->readOnly = false;
$this->extractCallback = null;
Expand Down
2 changes: 1 addition & 1 deletion Archive/src/tar/headers/gnu.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct( ezcArchiveBlockFile $file = null )
{
// FIXME Assumed a while.. check the gnu tar source file.
// FIXME Check long links, really large files, etc.
$extensions = array();
$extensions = [];

do
{
Expand Down
2 changes: 1 addition & 1 deletion Archive/src/tar/headers/pax.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __get( $name )
*/
protected function getPaxDecodedHeader( ezcArchiveBlockFile $file )
{
$result = array();
$result = [];

// next block has the info.
$file->next();
Expand Down
12 changes: 6 additions & 6 deletions Archive/src/tar/headers/v7.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,34 @@ class ezcArchiveV7Header
/**
* Relative byte position that the header starts.
*/
const START_HEADER = 0;
public const START_HEADER = 0;

/**
* Relative byte position that the checksum starts.
*/
const CHECKSUM_OFFSET = 148;
public const CHECKSUM_OFFSET = 148;

/**
* Number of bytes that the checksum occupies.
*/
const CHECKSUM_SIZE = 8;
public const CHECKSUM_SIZE = 8;

/**
* Relative byte position that the checksum ends.
*/
const END_HEADER = 512;
public const END_HEADER = 512;

/**
* Number of bytes that a block occupies.
*/
const BLOCK_SIZE = 512;
public const BLOCK_SIZE = 512;

/**
* Holds the properties of this class.
*
* @var array(string=>mixed)
*/
protected $properties = array();
protected $properties = [];

/**
* Sets the property $name to $value.
Expand Down
8 changes: 4 additions & 4 deletions Archive/src/tar/v7.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ezcArchiveV7Tar extends ezcArchive
/**
* Amount of bytes in a block.
*/
const BLOCK_SIZE = 512;
public const BLOCK_SIZE = 512;

/**
* Tar archives have always $blockFactor of blocks.
Expand Down Expand Up @@ -99,8 +99,8 @@ public function __construct( ezcArchiveBlockFile $file, $blockFactor = 20 )
$this->blockFactor = $blockFactor;
$this->file = $file;

$this->headers = array();
$this->headerPositions = array();
$this->headers = [];
$this->headerPositions = [];

$this->entriesRead = 0;
$this->fileNumber = 0;
Expand Down Expand Up @@ -519,7 +519,7 @@ protected function appendHeaderAndFileToCurrent( $entry )
if ( !$this->isEmpty() && $this->file->getFileAccess() !== ezcArchiveFile::WRITE_ONLY )
{
// Truncate the next file and don't add the null blocks.
$this->truncate( $this->fileNumber + 1, false );
$this->truncate( $this->fileNumber + 1 );
}

if ( $this->entriesRead == 0 )
Expand Down
20 changes: 10 additions & 10 deletions Archive/src/utils/stat_mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,51 @@ class ezcArchiveStatMode
/**
* Type of the file.
*/
const S_IFMT = 0170000;
public const S_IFMT = 0170000;

/**
* Named pipe (fifo).
*/
const S_IFIFO = 0010000;
public const S_IFIFO = 0010000;

/**
* character special.
*/
const S_IFCHR = 0020000;
public const S_IFCHR = 0020000;

/**
* Directory
*/
const S_IFDIR = 0040000;
public const S_IFDIR = 0040000;

/**
* block special
*/
const S_IFBLK = 0060000;
public const S_IFBLK = 0060000;

/**
* regular file
*/
const S_IFREG = 0100000;
public const S_IFREG = 0100000;

/**
* Symbolic link
*/
const S_IFLNK = 0120000;
public const S_IFLNK = 0120000;

/**
* Socket
*/
const S_IFSOCK = 0140000;
public const S_IFSOCK = 0140000;

/**
* Whiteout
*/
const S_IFWHT = 0160000;
public const S_IFWHT = 0160000;

/**
* Permission mask
*/
const S_PERM_MASK = 07777;
public const S_PERM_MASK = 07777;
}
?>
2 changes: 1 addition & 1 deletion Archive/src/zip/headers/central_directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ezcArchiveCentralDirectoryHeader extends ezcArchiveLocalFileHeader
/**
* Defines the signature of this header.
*/
const magic = 0x02014b50;
public const magic = 0x02014b50;

/**
* Creates and initializes a new header.
Expand Down
Loading

0 comments on commit bcc5cd2

Please sign in to comment.