Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move deep_clone in Alice namespace #727

Merged
merged 1 commit into from
May 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

"autoload": {
"files": [
"src/functions.php"
"src/deep_clone.php"
],
"psr-4": {
"Nelmio\\Alice\\": "src"
Expand Down
1 change: 1 addition & 0 deletions fixtures/Definition/Object/ImmutableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Object;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\ObjectInterface;

class ImmutableObject implements ObjectInterface
Expand Down
2 changes: 2 additions & 0 deletions fixtures/Entity/ImmutableStd.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Nelmio\Alice\Entity;

use function Nelmio\Alice\deep_clone;

class ImmutableStd
{
private $properties;
Expand Down
4 changes: 3 additions & 1 deletion src/Definition/FlagBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
declare(strict_types=1);

namespace Nelmio\Alice\Definition;
use ArrayIterator;
use function Nelmio\Alice\deep_clone;

/**
* Collection of flags.
Expand Down Expand Up @@ -101,7 +103,7 @@ public function getKey(): string
*/
public function getIterator()
{
return new \ArrayIterator(array_values($this->flags));
return new ArrayIterator(array_values($this->flags));
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/ArrayValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;

final class ArrayValue implements ValueInterface
Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/ChoiceListValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/DynamicArrayValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;
use Nelmio\Alice\Throwable\Error\TypeErrorFactory;

Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/FunctionCallValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/ListValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/ParameterValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;
use Nelmio\Alice\Throwable\Error\TypeErrorFactory;

Expand Down
1 change: 1 addition & 0 deletions src/Definition/Value/UniqueValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Definition\Value;

use function Nelmio\Alice\deep_clone;
use Nelmio\Alice\Definition\ValueInterface;
use Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory;

Expand Down
28 changes: 28 additions & 0 deletions src/deep_clone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/*
* This file is part of the Alice package.
*
* (c) Nelmio <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Nelmio\Alice;

use DeepCopy\DeepCopy;

/**
* Deep clone the given value.
*
* @param mixed $value
*
* @return mixed
*/
function deep_clone($value)
{
return (new DeepCopy())->copy($value);
}
26 changes: 0 additions & 26 deletions src/functions.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Generator\Resolver\Fixture;

use function Nelmio\Alice\deep_clone;
use PHPUnit\Framework\TestCase;
use Nelmio\Alice\Definition\FakeMethodCall;
use Nelmio\Alice\Definition\Fixture\DummyFixture;
Expand Down