Skip to content
Permalink
Browse files

Fix whitespace discussion points

  • Loading branch information...
jaapio committed Oct 16, 2019
1 parent e291012 commit d5e33df7de4537f06cd18a47f65f4a803bcd3775
Showing with 992 additions and 950 deletions.
  1. +15 −2 phpcs.xml.dist
  2. +2 −2 src/main/php/org/bovigo/vfs/DotDirectory.php
  3. +5 −4 src/main/php/org/bovigo/vfs/Quota.php
  4. +9 −9 src/main/php/org/bovigo/vfs/content/FileContent.php
  5. +8 −8 src/main/php/org/bovigo/vfs/content/LargeFileContent.php
  6. +9 −9 src/main/php/org/bovigo/vfs/content/SeekableFileContent.php
  7. +5 −5 src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php
  8. +31 −24 src/main/php/org/bovigo/vfs/vfsStream.php
  9. +45 −36 src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php
  10. +7 −6 src/main/php/org/bovigo/vfs/vfsStreamContainer.php
  11. +5 −5 src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php
  12. +27 −23 src/main/php/org/bovigo/vfs/vfsStreamContent.php
  13. +18 −17 src/main/php/org/bovigo/vfs/vfsStreamDirectory.php
  14. +27 −27 src/main/php/org/bovigo/vfs/vfsStreamFile.php
  15. +50 −50 src/main/php/org/bovigo/vfs/vfsStreamWrapper.php
  16. +4 −3 src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php
  17. +8 −6 src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php
  18. +8 −6 src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php
  19. +6 −5 src/main/php/org/bovigo/vfs/visitor/vfsStreamVisitor.php
  20. +26 −26 src/test/php/org/bovigo/vfs/DirectoryIterationTestCase.php
  21. +8 −8 src/test/php/org/bovigo/vfs/FilenameTestCase.php
  22. +4 −4 src/test/php/org/bovigo/vfs/Issue104TestCase.php
  23. +10 −10 src/test/php/org/bovigo/vfs/PermissionsTestCase.php
  24. +7 −7 src/test/php/org/bovigo/vfs/QuotaTestCase.php
  25. +7 −7 src/test/php/org/bovigo/vfs/UnlinkTestCase.php
  26. +19 −19 src/test/php/org/bovigo/vfs/content/LargeFileContentTestCase.php
  27. +22 −22 src/test/php/org/bovigo/vfs/content/StringBasedFileContentTestCase.php
  28. +29 −29 src/test/php/org/bovigo/vfs/vfsStreamAbstractContentTestCase.php
  29. +11 −11 src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php
  30. +6 −6 src/test/php/org/bovigo/vfs/vfsStreamContainerIteratorTestCase.php
  31. +3 −3 src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue134TestCase.php
  32. +5 −5 src/test/php/org/bovigo/vfs/vfsStreamDirectoryIssue18TestCase.php
  33. +39 −39 src/test/php/org/bovigo/vfs/vfsStreamDirectoryTestCase.php
  34. +4 −4 src/test/php/org/bovigo/vfs/vfsStreamExLockTestCase.php
  35. +46 −46 src/test/php/org/bovigo/vfs/vfsStreamFileTestCase.php
  36. +1 −1 src/test/php/org/bovigo/vfs/vfsStreamGlobTestCase.php
  37. +4 −4 src/test/php/org/bovigo/vfs/vfsStreamResolveIncludePathTestCase.php
  38. +51 −51 src/test/php/org/bovigo/vfs/vfsStreamTestCase.php
  39. +17 −17 src/test/php/org/bovigo/vfs/vfsStreamUmaskTestCase.php
  40. +4 −4 src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php
  41. +4 −4 src/test/php/org/bovigo/vfs/vfsStreamWrapperBaseTestCase.php
  42. +4 −4 src/test/php/org/bovigo/vfs/vfsStreamWrapperDirSeparatorTestCase.php
  43. +42 −42 src/test/php/org/bovigo/vfs/vfsStreamWrapperDirTestCase.php
  44. +45 −45 src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTestCase.php
  45. +20 −20 src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php
  46. +57 −57 src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php
  47. +6 −6 src/test/php/org/bovigo/vfs/vfsStreamWrapperLargeFileTestCase.php
  48. +12 −12 src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php
  49. +6 −6 src/test/php/org/bovigo/vfs/vfsStreamWrapperSetOptionTestCase.php
  50. +6 −6 src/test/php/org/bovigo/vfs/vfsStreamWrapperStreamSelectTestCase.php
  51. +134 −134 src/test/php/org/bovigo/vfs/vfsStreamWrapperTestCase.php
  52. +7 −7 src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
  53. +5 −5 src/test/php/org/bovigo/vfs/vfsStreamWrapperWithoutRootTestCase.php
  54. +2 −2 src/test/php/org/bovigo/vfs/vfsStreamZipTestCase.php
  55. +7 −7 src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php
  56. +15 −15 src/test/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitorTestCase.php
  57. +8 −8 src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php
@@ -1,19 +1,26 @@
<?xml version="1.0"?>
<ruleset name="phpDocumentor">
<description>The coding standard for phpDocumentor.</description>
<ruleset name="vfsStream">
<description>The coding standard for vfsStream.</description>

<file>src/main/php/org/bovigo/vfs</file>
<file>src/test/php/org/bovigo/vfs</file>
<arg value="p"/>
<rule ref="Doctrine">
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden" />
<exclude name="Generic.Formatting.MultipleStatementAlignment" />
</rule>

<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix">
<exclude-pattern>src/main/php/org/bovigo/vfs/vfsStreamException.php</exclude-pattern>
</rule>

<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreSpacingBeforeAssignments" value="false" />
</properties>
</rule>

<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>src/test/*</exclude-pattern>
<exclude-pattern>/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php</exclude-pattern>
@@ -30,4 +37,10 @@
<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>*/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
<properties>
<property name="spacesCountBeforeColon" value="0"/>
</properties>
</rule>
</ruleset>
@@ -22,15 +22,15 @@ class DotDirectory extends vfsStreamDirectory
/**
* returns iterator for the children
*/
public function getIterator() : Iterator
public function getIterator(): Iterator
{
return new ArrayIterator([]);
}
/**
* checks whether dir is a dot dir
*/
public function isDot() : bool
public function isDot(): bool
{
return true;
}
@@ -14,8 +14,9 @@
/**
* Represents a quota for disk space.
*
* @since 1.1.0
* @internal
*
* @since 1.1.0
*/
class Quota
{
@@ -45,23 +46,23 @@ public function __construct(int $amount)
/**
* create with unlimited space
*/
public static function unlimited() : self
public static function unlimited(): self
{
return new self(self::UNLIMITED);
}
/**
* checks if a quota is set
*/
public function isLimited() : bool
public function isLimited(): bool
{
return self::UNLIMITED < $this->amount;
}
/**
* checks if given used space exceeda quota limit
*/
public function spaceLeft(int $usedSpace) : int
public function spaceLeft(int $usedSpace): int
{
if ($this->amount === self::UNLIMITED) {
return $usedSpace;
@@ -21,48 +21,48 @@ interface FileContent
/**
* returns actual content
*/
public function content() : string;
public function content(): string;
/**
* returns size of content
*/
public function size() : int;
public function size(): int;
/**
* reads the given amount of bytes from content
*/
public function read(int $count) : string;
public function read(int $count): string;
/**
* seeks to the given offset
*/
public function seek(int $offset, int $whence) : bool;
public function seek(int $offset, int $whence): bool;
/**
* checks whether pointer is at end of file
*/
public function eof() : bool;
public function eof(): bool;
/**
* writes an amount of data
*
* @return int amount of written bytes
*/
public function write(string $data) : int;
public function write(string $data): int;
/**
* Truncates a file to a given length
*
* @param int $size length to truncate file to
*/
public function truncate(int $size) : bool;
public function truncate(int $size): bool;
/**
* Returns the current position within the file.
*
* @internal
*/
public function bytesRead() : int;
public function bytesRead(): int;
/**
* Returns the content until its end from current offset.
@@ -71,5 +71,5 @@ public function bytesRead() : int;
*
* @internal
*/
public function readUntilEnd() : string;
public function readUntilEnd(): string;
}
@@ -57,47 +57,47 @@ public function __construct(int $size)
/**
* create large file with given size in kilobyte
*/
public static function withKilobytes(int $kilobyte) : self
public static function withKilobytes(int $kilobyte): self
{
return new self($kilobyte * 1024);
}
/**
* create large file with given size in megabyte
*/
public static function withMegabytes(int $megabyte) : self
public static function withMegabytes(int $megabyte): self
{
return self::withKilobytes($megabyte * 1024);
}
/**
* create large file with given size in gigabyte
*/
public static function withGigabytes(int $gigabyte) : self
public static function withGigabytes(int $gigabyte): self
{
return self::withMegabytes($gigabyte * 1024);
}
/**
* returns actual content
*/
public function content() : string
public function content(): string
{
return $this->doRead(0, $this->size);
}
/**
* returns size of content
*/
public function size() : int
public function size(): int
{
return $this->size;
}
/**
* actual reading of given byte count starting at given offset
*/
protected function doRead(int $offset, int $count) : string
protected function doRead(int $offset, int $count): string
{
if (($offset + $count) > $this->size) {
$count = $this->size - $offset;
@@ -114,7 +114,7 @@ protected function doRead(int $offset, int $count) : string
/**
* actual writing of data with specified length at given offset
*/
protected function doWrite(string $data, int $offset, int $length) : void
protected function doWrite(string $data, int $offset, int $length): void
{
for ($i = 0; $i < $length; $i++) {
$this->content[$i + $offset] = substr($data, $i, 1);
@@ -132,7 +132,7 @@ protected function doWrite(string $data, int $offset, int $length) : void
*
* @param int $size length to truncate file to
*/
public function truncate(int $size) : bool
public function truncate(int $size): bool
{
$this->size = $size;
foreach (array_filter(
@@ -34,9 +34,9 @@ abstract class SeekableFileContent implements FileContent
/**
* reads the given amount of bytes from content
*/
public function read(int $count) : string
public function read(int $count): string
{
$data = $this->doRead($this->offset, $count);
$data = $this->doRead($this->offset, $count);
$this->offset += $count;
return $data;
@@ -45,12 +45,12 @@ public function read(int $count) : string
/**
* actual reading of given byte count starting at given offset
*/
abstract protected function doRead(int $offset, int $count) : string;
abstract protected function doRead(int $offset, int $count): string;
/**
* seeks to the given offset
*/
public function seek(int $offset, int $whence) : bool
public function seek(int $offset, int $whence): bool
{
$newOffset = $this->offset;
switch ($whence) {
@@ -82,7 +82,7 @@ public function seek(int $offset, int $whence) : bool
/**
* checks whether pointer is at end of file
*/
public function eof() : bool
public function eof(): bool
{
return $this->size() <= $this->offset;
}
@@ -92,7 +92,7 @@ public function eof() : bool
*
* @return int amount of written bytes
*/
public function write(string $data) : int
public function write(string $data): int
{
$dataLength = strlen($data);
$this->doWrite($data, $this->offset, $dataLength);
@@ -104,14 +104,14 @@ public function write(string $data) : int
/**
* actual writing of data with specified length at given offset
*/
abstract protected function doWrite(string $data, int $offset, int $length) : void;
abstract protected function doWrite(string $data, int $offset, int $length): void;
/**
* for backwards compatibility with vfsStreamFile::bytesRead()
*
* @internal
*/
public function bytesRead() : int
public function bytesRead(): int
{
return $this->offset;
}
@@ -121,7 +121,7 @@ public function bytesRead() : int
*
* @internal
*/
public function readUntilEnd() : string
public function readUntilEnd(): string
{
/** @var string|false $data */
$data = substr($this->content(), $this->offset);
@@ -40,23 +40,23 @@ public function __construct(string $content)
/**
* returns actual content
*/
public function content() : string
public function content(): string
{
return $this->content;
}
/**
* returns size of content
*/
public function size() : int
public function size(): int
{
return strlen($this->content);
}
/**
* actual reading of length starting at given offset
*/
protected function doRead(int $offset, int $count) : string
protected function doRead(int $offset, int $count): string
{
/** @var string|false $data */
$data = substr($this->content, $offset, $count);
@@ -67,7 +67,7 @@ protected function doRead(int $offset, int $count) : string
/**
* actual writing of data with specified length at given offset
*/
protected function doWrite(string $data, int $offset, int $length) : void
protected function doWrite(string $data, int $offset, int $length): void
{
$this->content = substr($this->content, 0, $offset)
. $data
@@ -79,7 +79,7 @@ protected function doWrite(string $data, int $offset, int $length) : void
*
* @param int $size length to truncate file to
*/
public function truncate(int $size) : bool
public function truncate(int $size): bool
{
if ($size > $this->size()) {
// Pad with null-chars if we're "truncating up"

0 comments on commit d5e33df

Please sign in to comment.
You can’t perform that action at this time.