Skip to content

Commit

Permalink
switch to new array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey179 committed Sep 26, 2017
1 parent 8bdc520 commit 98d0fb5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/main/php/org/bovigo/vfs/content/LargeFileContent.php
Expand Up @@ -29,7 +29,7 @@ class LargeFileContent extends SeekableFileContent implements FileContent
*
* @type char[]
*/
private $content = array();
private $content = [];
/**
* file size in bytes
*
Expand Down
18 changes: 9 additions & 9 deletions src/main/php/org/bovigo/vfs/vfsStream.php
Expand Up @@ -129,14 +129,14 @@ public static function umask(int $umask = null): int
*
* Assumed $structure contains an array like this:
* <code>
* array('Core' = array('AbstractFactory' => array('test.php' => 'some text content',
* 'other.php' => 'Some more text content',
* 'Invalid.csv' => 'Something else',
* ),
* 'AnEmptyFolder' => array(),
* 'badlocation.php' => 'some bad content',
* )
* )
* ['Core' = ['AbstractFactory' => ['test.php' => 'some text content',
* 'other.php' => 'Some more text content',
* 'Invalid.csv' => 'Something else',
* ],
* 'AnEmptyFolder' => [],
* 'badlocation.php' => 'some bad content',
* ]
* ]
* </code>
* the resulting directory tree will look like this:
* <pre>
Expand Down Expand Up @@ -237,7 +237,7 @@ protected static function addStructure(array $structure, vfsStreamDirectory $bas
} elseif (is_string($data) === true) {
$matches = null;
preg_match('/^\[(.*)\]$/', $name, $matches);
if ($matches !== array()) {
if ($matches !== []) {
self::newBlock($matches[1])->withContent($data)->at($baseDir);
} else {
self::newFile($name)->withContent($data)->at($baseDir);
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/org/bovigo/vfs/vfsStreamFile.php
Expand Up @@ -34,7 +34,7 @@ class vfsStreamFile extends vfsStreamAbstractContent
*
* @type bool[string]
*/
protected $sharedLock = array();
protected $sharedLock = [];

/**
* constructor
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
Expand Up @@ -280,8 +280,8 @@ protected function resolvePath(string $path): string
public function stream_open(string $path, string $mode, string $options, string $opened_path = null): bool
{
$extended = ((strstr($mode, '+') !== false) ? (true) : (false));
$mode = str_replace(array('t', 'b', '+'), '', $mode);
if (in_array($mode, array('r', 'w', 'a', 'x', 'c')) === false) {
$mode = str_replace(['t', 'b', '+'], '', $mode);
if (in_array($mode, ['r', 'w', 'a', 'x', 'c']) === false) {
if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) {
trigger_error('Illegal mode ' . $mode . ', use r, w, a, x or c, flavoured with t, b and/or +', E_USER_WARNING);
}
Expand Down
Expand Up @@ -75,7 +75,7 @@ public function visitBlockDevice(vfsStreamBlock $block): vfsStreamVisitor
*/
public function visitDirectory(vfsStreamDirectory $dir): vfsStreamVisitor
{
$this->current[$dir->getName()] = array();
$this->current[$dir->getName()] = [];
$tmp =& $this->current;
$this->current =& $tmp[$dir->getName()];
foreach ($dir as $child) {
Expand Down Expand Up @@ -104,7 +104,7 @@ public function getStructure(): array
*/
public function reset(): self
{
$this->structure = array();
$this->structure = [];
$this->current =& $this->structure;
return $this;
}
Expand Down

0 comments on commit 98d0fb5

Please sign in to comment.