diff --git a/CHANGELOG.md b/CHANGELOG.md index bbc10553..14af5740 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +======= +1.7.0 (20??-??-??) +------------------ + + * Namespace changed from `org\bovigo\vfs` to `bovigo\vfs` + - The old namespace still works, but has been deprecated. It will be removed in version 2. + + 1.6.8 (2019-10-30) ------------------ diff --git a/composer.json b/composer.json index 9d1f3f0e..722e7475 100644 --- a/composer.json +++ b/composer.json @@ -23,11 +23,19 @@ "phpunit/phpunit": "^4.5|^5.0" }, "autoload": { - "psr-0": { "org\\bovigo\\vfs\\": "src/main/php" } + "psr-4": { + "bovigo\\vfs\\": "src", + "org\\bovigo\\vfs\\": "org/bovigo/vfs" + } + }, + "autoload-dev": { + "psr-4": { + "bovigo\\vfs\\tests\\": "tests/phpunit" + } }, "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } } } diff --git a/examples/Example.php b/examples/Example.php index a12caeec..59fb1780 100644 --- a/examples/Example.php +++ b/examples/Example.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; /** * Example class. */ @@ -51,4 +51,4 @@ public function setDirectory($directory) // more source code here... } -?> \ No newline at end of file +?> diff --git a/examples/ExampleTestCaseOldWay.php b/examples/ExampleTestCaseOldWay.php index 4ecb9d8d..e54d2ed7 100644 --- a/examples/ExampleTestCaseOldWay.php +++ b/examples/ExampleTestCaseOldWay.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; require_once 'Example.php'; /** * Test case for class Example. @@ -45,4 +45,4 @@ public function directoryIsCreated() $this->assertTrue(file_exists(__DIR__ . '/id')); } } -?> \ No newline at end of file +?> diff --git a/examples/ExampleTestCaseWithVfsStream.php b/examples/ExampleTestCaseWithVfsStream.php index 97c8a374..8103846d 100644 --- a/examples/ExampleTestCaseWithVfsStream.php +++ b/examples/ExampleTestCaseWithVfsStream.php @@ -5,10 +5,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; -use org\bovigo\vfs\vfsStream; +namespace bovigo\vfs\example; +use bovigo\vfs\vfsStream; require_once 'Example.php'; /** * Test case for class Example. @@ -44,4 +44,4 @@ public function directoryIsCreated() $this->assertTrue($this->root->hasChild('id')); } } -?> \ No newline at end of file +?> diff --git a/examples/FailureExample.php b/examples/FailureExample.php index 472468b2..0ae7dd3b 100644 --- a/examples/FailureExample.php +++ b/examples/FailureExample.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; /** * Example class to demonstrate testing of failure behaviour with vfsStream. */ @@ -47,4 +47,4 @@ public function writeData($data) // more source code here... } -?> \ No newline at end of file +?> diff --git a/examples/FailureExampleTestCase.php b/examples/FailureExampleTestCase.php index e2123055..ac27dbc7 100644 --- a/examples/FailureExampleTestCase.php +++ b/examples/FailureExampleTestCase.php @@ -5,10 +5,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; -use org\bovigo\vfs\vfsStream; +namespace bovigo\vfs\example; +use bovigo\vfs\vfsStream; require_once 'FailureExample.php'; /** * Test case for class FailureExample. @@ -55,4 +55,4 @@ public function returnsErrorMessageIfWritingToFileFails() $this->assertSame('notoverwritten', $this->root->getChild('test.txt')->getContent()); } } -?> \ No newline at end of file +?> diff --git a/examples/FileModeExampleTestCaseOldWay.php b/examples/FileModeExampleTestCaseOldWay.php index 9f996711..2d3ebcf5 100644 --- a/examples/FileModeExampleTestCaseOldWay.php +++ b/examples/FileModeExampleTestCaseOldWay.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; require_once 'FilemodeExample.php'; /** * Test case for class FilemodeExample. @@ -64,4 +64,4 @@ public function testDirectoryHasCorrectDifferentFilePermissions() } } } -?> \ No newline at end of file +?> diff --git a/examples/FilePermissionsExample.php b/examples/FilePermissionsExample.php index 6258a5d7..7733696c 100644 --- a/examples/FilePermissionsExample.php +++ b/examples/FilePermissionsExample.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; /** * Example showing correct file permission support introduced with 0.7.0. */ @@ -26,4 +26,4 @@ public function writeConfig($config, $configFile) // more methods here } -?> \ No newline at end of file +?> diff --git a/examples/FilePermissionsExampleTestCase.php b/examples/FilePermissionsExampleTestCase.php index 66466362..9e879433 100644 --- a/examples/FilePermissionsExampleTestCase.php +++ b/examples/FilePermissionsExampleTestCase.php @@ -5,10 +5,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; -use org\bovigo\vfs\vfsStream; +namespace bovigo\vfs\example; +use bovigo\vfs\vfsStream; require_once 'FilePermissionsExample.php'; /** * Test for FilePermissionsExample. @@ -41,4 +41,4 @@ public function directoryNotWritable() ); } } -?> \ No newline at end of file +?> diff --git a/examples/FilemodeExample.php b/examples/FilemodeExample.php index c2ac364c..60e3eb93 100644 --- a/examples/FilemodeExample.php +++ b/examples/FilemodeExample.php @@ -5,9 +5,9 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; +namespace bovigo\vfs\example; /** * Example class. */ @@ -59,4 +59,4 @@ public function setDirectory($directory) // more source code here... } -?> \ No newline at end of file +?> diff --git a/examples/FilemodeExampleTestCaseWithVfsStream.php b/examples/FilemodeExampleTestCaseWithVfsStream.php index 675a2c72..bdf552c0 100644 --- a/examples/FilemodeExampleTestCaseWithVfsStream.php +++ b/examples/FilemodeExampleTestCaseWithVfsStream.php @@ -5,10 +5,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs\example; -use org\bovigo\vfs\vfsStream; +namespace bovigo\vfs\example; +use bovigo\vfs\vfsStream; require_once 'FilemodeExample.php'; /** * Test case for class FilemodeExample. @@ -50,4 +50,4 @@ public function testDirectoryIsCreatedWithGivenPermissions() $this->assertEquals(0755, $this->root->getChild('id')->getPermissions()); } } -?> \ No newline at end of file +?> diff --git a/org/bovigo/vfs/DotDirectory.php b/org/bovigo/vfs/DotDirectory.php new file mode 100644 index 00000000..d81908d9 --- /dev/null +++ b/org/bovigo/vfs/DotDirectory.php @@ -0,0 +1,16 @@ + + + The coding standard for vfsStream. + + src + tests/phpunit + + + + + + + + + src/vfsStreamException.php + + + + + + + + + + tests/* + src/vfsStreamWrapper.php + + + + + src/* + + + + tests/phpunit/vfsStreamDirectoryIssue134TestCase.php + + + + tests/phpunit/vfsStreamWrapperAlreadyRegisteredTestCase.php + + + + tests/phpunit/vfsStreamWrapperAlreadyRegisteredTestCase.php + + + + + + + + diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml index 9cc27972..631216c4 100644 --- a/phpdoc.dist.xml +++ b/phpdoc.dist.xml @@ -3,12 +3,12 @@ vfsStream API Doc docs/api - org\bovigo\vfs + bovigo\vfs docs/api - src/main/php + src - \ No newline at end of file + diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..37543bdf --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,13 @@ +includes: + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/phpstan/phpstan-deprecation-rules/rules.neon + +parameters: + level: 4 + paths: + - src + ignoreErrors: + - + message: '/Default value of the parameter #1 \$out \(mixed\) of method [a-zA-Z0-9\\_]+::__construct\(\) is incompatible with type resource/' + path: %currentWorkingDirectory%/src/visitor/vfsStreamPrintVisitor.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1e6720a4..e92c4971 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ - - ./src/test/phpt - ./src/test/php + + tests/phpt + tests/phpunit - src/main/php + src diff --git a/src/main/php/org/bovigo/vfs/DotDirectory.php b/src/DotDirectory.php similarity index 80% rename from src/main/php/org/bovigo/vfs/DotDirectory.php rename to src/DotDirectory.php index b17b9796..bde269b3 100644 --- a/src/main/php/org/bovigo/vfs/DotDirectory.php +++ b/src/DotDirectory.php @@ -7,7 +7,13 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use ArrayIterator; +use Iterator; +use function class_alias; + /** * Directory container. */ @@ -33,3 +39,5 @@ public function isDot() return true; } } + +class_alias('bovigo\vfs\DotDirectory', 'org\bovigo\vfs\DotDirectory'); diff --git a/src/main/php/org/bovigo/vfs/Quota.php b/src/Quota.php similarity index 93% rename from src/main/php/org/bovigo/vfs/Quota.php rename to src/Quota.php index 7635f1d2..62d23086 100644 --- a/src/main/php/org/bovigo/vfs/Quota.php +++ b/src/Quota.php @@ -7,7 +7,11 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use function class_alias; + /** * Represents a quota for disk space. * @@ -84,3 +88,5 @@ public function spaceLeft($usedSpace) return $spaceLeft; } } + +class_alias('bovigo\vfs\Quota', 'org\bovigo\vfs\Quota'); diff --git a/src/main/php/org/bovigo/vfs/content/FileContent.php b/src/content/FileContent.php similarity index 90% rename from src/main/php/org/bovigo/vfs/content/FileContent.php rename to src/content/FileContent.php index e62e3098..e9920dc2 100644 --- a/src/main/php/org/bovigo/vfs/content/FileContent.php +++ b/src/content/FileContent.php @@ -7,7 +7,11 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\content; + +namespace bovigo\vfs\content; + +use function class_alias; + /** * Interface for actual file contents. * @@ -69,3 +73,5 @@ public function write($data); */ public function truncate($size); } + +class_alias('bovigo\vfs\content\FileContent', 'org\bovigo\vfs\content\FileContent'); diff --git a/src/main/php/org/bovigo/vfs/content/LargeFileContent.php b/src/content/LargeFileContent.php similarity index 94% rename from src/main/php/org/bovigo/vfs/content/LargeFileContent.php rename to src/content/LargeFileContent.php index a0035270..1ce140a7 100644 --- a/src/main/php/org/bovigo/vfs/content/LargeFileContent.php +++ b/src/content/LargeFileContent.php @@ -7,7 +7,14 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\content; + +namespace bovigo\vfs\content; + +use function array_filter; +use function array_keys; +use function class_alias; +use function substr; + /** * File content implementation to mock large files. * @@ -165,3 +172,5 @@ function($pos) use ($size) return true; } } + +class_alias('bovigo\vfs\content\LargeFileContent', 'org\bovigo\vfs\content\LargeFileContent'); diff --git a/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php b/src/content/SeekableFileContent.php similarity index 91% rename from src/main/php/org/bovigo/vfs/content/SeekableFileContent.php rename to src/content/SeekableFileContent.php index 960284cf..0c266592 100644 --- a/src/main/php/org/bovigo/vfs/content/SeekableFileContent.php +++ b/src/content/SeekableFileContent.php @@ -7,7 +7,16 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\content; + +namespace bovigo\vfs\content; + +use const SEEK_CUR; +use const SEEK_END; +use const SEEK_SET; +use function class_alias; +use function strlen; +use function substr; + /** * Default implementation for file contents based on simple strings. * @@ -132,3 +141,5 @@ public function readUntilEnd() return substr($this->content(), $this->offset); } } + +class_alias('bovigo\vfs\content\SeekableFileContent', 'org\bovigo\vfs\content\SeekableFileContent'); diff --git a/src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php b/src/content/StringBasedFileContent.php similarity index 89% rename from src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php rename to src/content/StringBasedFileContent.php index 77adf8e5..c9b97427 100644 --- a/src/main/php/org/bovigo/vfs/content/StringBasedFileContent.php +++ b/src/content/StringBasedFileContent.php @@ -7,7 +7,14 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\content; + +namespace bovigo\vfs\content; + +use function class_alias; +use function str_repeat; +use function strlen; +use function substr; + /** * Default implementation for file contents based on simple strings. * @@ -95,3 +102,5 @@ public function truncate($size) return true; } } + +class_alias('bovigo\vfs\content\StringBasedFileContent', 'org\bovigo\vfs\content\StringBasedFileContent'); diff --git a/src/main/php/org/bovigo/vfs/vfsStream.php b/src/vfsStream.php similarity index 95% rename from src/main/php/org/bovigo/vfs/vfsStream.php rename to src/vfsStream.php index 1eb382df..1ccae6ab 100644 --- a/src/main/php/org/bovigo/vfs/vfsStream.php +++ b/src/vfsStream.php @@ -7,10 +7,35 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; -use org\bovigo\vfs\content\LargeFileContent; -use org\bovigo\vfs\content\FileContent; -use org\bovigo\vfs\visitor\vfsStreamVisitor; + +namespace bovigo\vfs; + +use bovigo\vfs\content\FileContent; +use bovigo\vfs\content\LargeFileContent; +use bovigo\vfs\visitor\vfsStreamVisitor; +use DirectoryIterator; +use InvalidArgumentException; +use function array_map; +use function class_alias; +use function explode; +use function file_get_contents; +use function filetype; +use function function_exists; +use function implode; +use function is_array; +use function is_string; +use function octdec; +use function posix_getgid; +use function posix_getuid; +use function preg_match; +use function rawurldecode; +use function sprintf; +use function str_replace; +use function strlen; +use function strpos; +use function substr; +use function trim; + /** * Some utility methods for vfsStream. * @@ -477,3 +502,5 @@ public static function enableDotfiles() self::$dotFiles = true; } } + +class_alias('bovigo\vfs\vfsStream', 'org\bovigo\vfs\vfsStream'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php b/src/vfsStreamAbstractContent.php similarity index 97% rename from src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php rename to src/vfsStreamAbstractContent.php index 7db2be28..cf6e6245 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.php +++ b/src/vfsStreamAbstractContent.php @@ -7,7 +7,16 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use function class_alias; +use function clearstatcache; +use function strlen; +use function strncmp; +use function strstr; +use function time; + /** * Base stream contents container. */ @@ -416,3 +425,5 @@ public function url() return vfsStream::url($this->path()); } } + +class_alias('bovigo\vfs\vfsStreamAbstractContent', 'org\bovigo\vfs\vfsStreamAbstractContent'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamBlock.php b/src/vfsStreamBlock.php similarity index 84% rename from src/main/php/org/bovigo/vfs/vfsStreamBlock.php rename to src/vfsStreamBlock.php index 128a96a3..2deed4cf 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamBlock.php +++ b/src/vfsStreamBlock.php @@ -7,7 +7,10 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use function class_alias; /** * Block container. @@ -32,3 +35,5 @@ public function __construct($name, $permissions = null) $this->type = vfsStreamContent::TYPE_BLOCK; } } + +class_alias('bovigo\vfs\vfsStreamBlock', 'org\bovigo\vfs\vfsStreamBlock'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamContainer.php b/src/vfsStreamContainer.php similarity index 89% rename from src/main/php/org/bovigo/vfs/vfsStreamContainer.php rename to src/vfsStreamContainer.php index 74faa9a1..cceb59e3 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamContainer.php +++ b/src/vfsStreamContainer.php @@ -7,7 +7,12 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use IteratorAggregate; +use function class_alias; + /** * Interface for stream contents that are able to store other stream contents. */ @@ -59,3 +64,5 @@ public function hasChildren(); */ public function getChildren(); } + +class_alias('bovigo\vfs\vfsStreamContainer', 'org\bovigo\vfs\vfsStreamContainer'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php b/src/vfsStreamContainerIterator.php similarity index 87% rename from src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php rename to src/vfsStreamContainerIterator.php index 99ea1f8b..abe5808c 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamContainerIterator.php +++ b/src/vfsStreamContainerIterator.php @@ -7,7 +7,16 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use Iterator; +use function array_unshift; +use function class_alias; +use function current; +use function next; +use function reset; + /** * Iterator for children of a directory container. */ @@ -91,3 +100,5 @@ public function valid() return (false !== current($this->children)); } } + +class_alias('bovigo\vfs\vfsStreamContainerIterator', 'org\bovigo\vfs\vfsStreamContainerIterator'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamContent.php b/src/vfsStreamContent.php similarity index 97% rename from src/main/php/org/bovigo/vfs/vfsStreamContent.php rename to src/vfsStreamContent.php index 03b5bab7..688fde6c 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamContent.php +++ b/src/vfsStreamContent.php @@ -7,7 +7,11 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use function class_alias; + /** * Interface for stream contents. */ @@ -211,3 +215,5 @@ public function path(); */ public function url(); } + +class_alias('bovigo\vfs\vfsStreamContent', 'org\bovigo\vfs\vfsStreamContent'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php b/src/vfsStreamDirectory.php similarity index 95% rename from src/main/php/org/bovigo/vfs/vfsStreamDirectory.php rename to src/vfsStreamDirectory.php index ffb6db3f..e1507748 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamDirectory.php +++ b/src/vfsStreamDirectory.php @@ -7,7 +7,17 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use Iterator; +use function array_values; +use function class_alias; +use function count; +use function strlen; +use function substr; +use function time; + /** * Directory container. * @@ -264,3 +274,5 @@ public function isDot() return false; } } + +class_alias('bovigo\vfs\vfsStreamDirectory', 'org\bovigo\vfs\vfsStreamDirectory'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamException.php b/src/vfsStreamException.php similarity index 69% rename from src/main/php/org/bovigo/vfs/vfsStreamException.php rename to src/vfsStreamException.php index b78afd18..f6e55bab 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamException.php +++ b/src/vfsStreamException.php @@ -7,7 +7,12 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use Exception; +use function class_alias; + /** * Exception for vfsStream errors. * @@ -17,3 +22,5 @@ class vfsStreamException extends \Exception { // intentionally empty } + +class_alias('bovigo\vfs\vfsStreamException', 'org\bovigo\vfs\vfsStreamException'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamFile.php b/src/vfsStreamFile.php similarity index 92% rename from src/main/php/org/bovigo/vfs/vfsStreamFile.php rename to src/vfsStreamFile.php index 33ee5639..c3d6df04 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamFile.php +++ b/src/vfsStreamFile.php @@ -5,11 +5,27 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package org\bovigo\vfs + * @package bovigo\vfs */ -namespace org\bovigo\vfs; -use org\bovigo\vfs\content\FileContent; -use org\bovigo\vfs\content\StringBasedFileContent; + +namespace bovigo\vfs; + +use bovigo\vfs\content\FileContent; +use bovigo\vfs\content\StringBasedFileContent; +use InvalidArgumentException; +use const LOCK_EX; +use const LOCK_NB; +use const LOCK_SH; +use const SEEK_END; +use const SEEK_SET; +use function class_alias; +use function is_resource; +use function is_string; +use function spl_object_hash; +use function sprintf; +use function stream_get_meta_data; +use function time; + /** * File container. * @@ -100,7 +116,12 @@ public function withContent($content) } elseif ($content instanceof FileContent) { $this->content = $content; } else { - throw new \InvalidArgumentException('Given content must either be a string or an instance of org\bovigo\vfs\content\FileContent'); + throw new InvalidArgumentException( + sprintf( + 'Given content must either be a string or an instance of %s', + FileContent::class + ) + ); } return $this; @@ -392,3 +413,5 @@ public function hasExclusiveLock($resource = null) return null !== $this->exclusiveLock; } } + +class_alias('bovigo\vfs\vfsStreamFile', 'org\bovigo\vfs\vfsStreamFile'); diff --git a/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php b/src/vfsStreamWrapper.php similarity index 96% rename from src/main/php/org/bovigo/vfs/vfsStreamWrapper.php rename to src/vfsStreamWrapper.php index 368b2fbe..4e18343b 100644 --- a/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php +++ b/src/vfsStreamWrapper.php @@ -7,7 +7,45 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs; + +namespace bovigo\vfs; + +use const E_USER_WARNING; +use const LOCK_NB; +use const LOCK_UN; +use const STREAM_META_ACCESS; +use const STREAM_META_GROUP; +use const STREAM_META_GROUP_NAME; +use const STREAM_META_OWNER; +use const STREAM_META_OWNER_NAME; +use const STREAM_META_TOUCH; +use const STREAM_OPTION_BLOCKING; +use const STREAM_OPTION_READ_TIMEOUT; +use const STREAM_OPTION_WRITE_BUFFER; +use const STREAM_REPORT_ERRORS; +use const STREAM_URL_STAT_QUIET; +use function array_merge; +use function array_pop; +use function array_values; +use function class_alias; +use function clearstatcache; +use function count; +use function explode; +use function implode; +use function in_array; +use function spl_object_id; +use function str_replace; +use function stream_get_wrappers; +use function stream_wrapper_register; +use function stream_wrapper_unregister; +use function strlen; +use function strpos; +use function strrpos; +use function strstr; +use function substr; +use function time; +use function trigger_error; + /** * Stream wrapper to mock file system requests. */ @@ -1010,3 +1048,5 @@ public function url_stat($path, $flags) return array_merge(array_values($fileStat), $fileStat); } } + +class_alias('bovigo\vfs\vfsStreamWrapper', 'org\bovigo\vfs\vfsStreamWrapper'); diff --git a/src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php b/src/visitor/vfsStreamAbstractVisitor.php similarity index 82% rename from src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php rename to src/visitor/vfsStreamAbstractVisitor.php index f9e597b9..44e1f093 100644 --- a/src/main/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitor.php +++ b/src/visitor/vfsStreamAbstractVisitor.php @@ -7,9 +7,15 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\visitor; -use org\bovigo\vfs\vfsStreamContent; -use org\bovigo\vfs\vfsStreamBlock; + +namespace bovigo\vfs\visitor; + +use bovigo\vfs\vfsStreamBlock; +use bovigo\vfs\vfsStreamContent; +use bovigo\vfs\vfsStreamDirectory; +use bovigo\vfs\vfsStreamFile; +use InvalidArgumentException; +use function class_alias; /** * Abstract base class providing an implementation for the visit() method. @@ -62,3 +68,5 @@ public function visitBlockDevice(vfsStreamBlock $block) return $this->visitFile($block); } } + +class_alias('bovigo\vfs\visitor\vfsStreamAbstractVisitor', 'org\bovigo\vfs\visitor\vfsStreamAbstractVisitor'); diff --git a/src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php b/src/visitor/vfsStreamPrintVisitor.php similarity index 85% rename from src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php rename to src/visitor/vfsStreamPrintVisitor.php index 15b0bc0c..cac81520 100644 --- a/src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.php +++ b/src/visitor/vfsStreamPrintVisitor.php @@ -7,11 +7,19 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\visitor; -use org\bovigo\vfs\vfsStreamContent; -use org\bovigo\vfs\vfsStreamDirectory; -use org\bovigo\vfs\vfsStreamFile; -use org\bovigo\vfs\vfsStreamBlock; + +namespace bovigo\vfs\visitor; + +use bovigo\vfs\vfsStreamBlock; +use bovigo\vfs\vfsStreamDirectory; +use bovigo\vfs\vfsStreamFile; +use InvalidArgumentException; +use const STDOUT; +use function class_alias; +use function fwrite; +use function get_resource_type; +use function is_resource; +use function str_repeat; /** * Visitor which traverses a content structure recursively to print it to an output stream. @@ -105,3 +113,5 @@ protected function printContent($name) fwrite($this->out, str_repeat(' ', $this->depth) . '- ' . $name . "\n"); } } + +class_alias('bovigo\vfs\visitor\vfsStreamPrintVisitor', 'org\bovigo\vfs\visitor\vfsStreamPrintVisitor'); diff --git a/src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php b/src/visitor/vfsStreamStructureVisitor.php similarity index 89% rename from src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php rename to src/visitor/vfsStreamStructureVisitor.php index 47acc45c..6617367d 100644 --- a/src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.php +++ b/src/visitor/vfsStreamStructureVisitor.php @@ -7,10 +7,13 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\visitor; -use org\bovigo\vfs\vfsStreamDirectory; -use org\bovigo\vfs\vfsStreamFile; -use org\bovigo\vfs\vfsStreamBlock; + +namespace bovigo\vfs\visitor; + +use bovigo\vfs\vfsStreamBlock; +use bovigo\vfs\vfsStreamDirectory; +use bovigo\vfs\vfsStreamFile; +use function class_alias; /** * Visitor which traverses a content structure recursively to create an array structure from it. @@ -109,3 +112,5 @@ public function reset() return $this; } } + +class_alias('bovigo\vfs\visitor\vfsStreamStructureVisitor', 'org\bovigo\vfs\visitor\vfsStreamStructureVisitor'); diff --git a/src/main/php/org/bovigo/vfs/visitor/vfsStreamVisitor.php b/src/visitor/vfsStreamVisitor.php similarity index 80% rename from src/main/php/org/bovigo/vfs/visitor/vfsStreamVisitor.php rename to src/visitor/vfsStreamVisitor.php index 21701058..5b2c0640 100644 --- a/src/main/php/org/bovigo/vfs/visitor/vfsStreamVisitor.php +++ b/src/visitor/vfsStreamVisitor.php @@ -7,11 +7,14 @@ * * @package org\bovigo\vfs */ -namespace org\bovigo\vfs\visitor; -use org\bovigo\vfs\vfsStreamContent; -use org\bovigo\vfs\vfsStreamDirectory; -use org\bovigo\vfs\vfsStreamFile; -use org\bovigo\vfs\vfsStreamBlock; + +namespace bovigo\vfs\visitor; + +use bovigo\vfs\vfsStreamBlock; +use bovigo\vfs\vfsStreamContent; +use bovigo\vfs\vfsStreamDirectory; +use bovigo\vfs\vfsStreamFile; +use function class_alias; /** * Interface for a visitor to work on a vfsStream content structure. @@ -53,3 +56,5 @@ public function visitDirectory(vfsStreamDirectory $dir); */ public function visitBlockDevice(vfsStreamBlock $block); } + +class_alias('bovigo\vfs\visitor\vfsStreamVisitor', 'org\bovigo\vfs\visitor\vfsStreamVisitor'); diff --git a/src/test/bootstrap.php b/tests/bootstrap.php similarity index 97% rename from src/test/bootstrap.php rename to tests/bootstrap.php index 13fdb23a..7d353464 100644 --- a/src/test/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,6 @@