diff --git a/composer.json b/composer.json index 5f3169e..64451ac 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ } ], "require": { - "php": ">=7.0" + "php": ">=7.0", + "symfony/var-dumper": "~3.3" }, "require-dev": { "mockery/mockery": "~1.0", @@ -18,15 +19,13 @@ }, "autoload": { "files": [ - "src/Illuminate/Support/helpers.php" + "src/Tightenco/Support/helpers.php", + "src/Tightenco/Support/alias.php" ], "psr-4": { - "Illuminate\\": "src/Illuminate" + "Tightenco\\": "src/Tightenco" } }, - "suggest": { - "symfony/var-dumper": "Required to prettify dd() and dump() (~3.3)." - }, "minimum-stability": "dev", "prefer-stable": true } diff --git a/composer.lock b/composer.lock index f125fb3..b8731a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,137 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "93255db3a480848e29f88498fd5d562a", - "packages": [], + "content-hash": "43a7cacf36bcbd12340ceb50d46308f6", + "packages": [ + { + "name": "symfony/polyfill-mbstring", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v3.4.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "472a9849930cf21f73abdb02240f17cf5b5bd1a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/472a9849930cf21f73abdb02240f17cf5b5bd1a7", + "reference": "472a9849930cf21f73abdb02240f17cf5b5bd1a7", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "require-dev": { + "ext-iconv": "*", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "ext-symfony_debug": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2018-01-29T09:03:43+00:00" + } + ], "packages-dev": [ { "name": "doctrine/instantiator", diff --git a/src/Illuminate/Contracts/Support/Arrayable.php b/src/Tightenco/Contracts/Support/Arrayable.php similarity index 78% rename from src/Illuminate/Contracts/Support/Arrayable.php rename to src/Tightenco/Contracts/Support/Arrayable.php index 5ad93b7..fd0ca6d 100644 --- a/src/Illuminate/Contracts/Support/Arrayable.php +++ b/src/Tightenco/Contracts/Support/Arrayable.php @@ -1,6 +1,6 @@ Illuminate\Contracts\Support\Arrayable::class, + Tightenco\Contracts\Support\Htmlable::class => Illuminate\Contracts\Support\Htmlable::class, + Tightenco\Contracts\Support\Jsonable::class => Illuminate\Contracts\Support\Jsonable::class, + + /** + * Support + */ + Tightenco\Support\Arr::class => Illuminate\Support\Arr::class, + Tightenco\Support\Collection::class => Illuminate\Support\Collection::class, + Tightenco\Support\HigherOrderCollectionProxy::class => Illuminate\Support\HigherOrderCollectionProxy::class, + Tightenco\Support\HtmlString::class => Illuminate\Support\HtmlString::class, + + /** + * Support\Debug + */ + Tightenco\Support\Debug\Dumper::class => Illuminate\Support\Debug\Dumper::class, + Tightenco\Support\Debug\HtmlDumper::class => Illuminate\Support\Debug\HtmlDumper::class, + + /** + * Support\Traits + */ + Tightenco\Support\Traits\Macroable::class => Illuminate\Support\Traits\Macroable::class, +]; + +foreach ($aliases as $tighten => $illuminate) { + if (! class_exists($illuminate) && ! interface_exists($illuminate) && ! trait_exists($illuminate)) { + class_alias($tighten, $illuminate); + } +} diff --git a/src/Illuminate/Support/helpers.php b/src/Tightenco/Support/helpers.php similarity index 98% rename from src/Illuminate/Support/helpers.php rename to src/Tightenco/Support/helpers.php index c802262..c045288 100644 --- a/src/Illuminate/Support/helpers.php +++ b/src/Tightenco/Support/helpers.php @@ -22,7 +22,7 @@ function array_wrap($value) * Create a collection from the given value. * * @param mixed $value - * @return \Illuminate\Support\Collection + * @return \Tightenco\Support\Collection */ function collect($value = null) { diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 0bb8c63..8721803 100644 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -1,6 +1,6 @@ shouldReceive('toArray')->once()->andReturn('foo.array'); - $item2 = m::mock('Illuminate\Contracts\Support\Arrayable'); + $item2 = m::mock('Tightenco\Contracts\Support\Arrayable'); $item2->shouldReceive('toArray')->once()->andReturn('bar.array'); $c = new Collection([$item1, $item2]); $results = $c->toArray(); @@ -187,7 +187,7 @@ public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollecti { $item1 = m::mock('JsonSerializable'); $item1->shouldReceive('jsonSerialize')->once()->andReturn('foo.json'); - $item2 = m::mock('Illuminate\Contracts\Support\Arrayable'); + $item2 = m::mock('Tightenco\Contracts\Support\Arrayable'); $item2->shouldReceive('toArray')->once()->andReturn('bar.array'); $c = new Collection([$item1, $item2]); $results = $c->jsonSerialize();