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

Refactor main mecanism (a.k.a v2) #38

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: php

php:
- 7.0
- 7.1
- hhvm

matrix:
Expand All @@ -13,6 +13,7 @@ sudo: false

install:
- travis_retry composer install --prefer-source --no-interaction
- travis_retry composer require symfony/property-access --no-interaction

script:
- phpunit --coverage-text --coverage-clover clover.xml
Expand Down
12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
],

"support": {
"email": "[email protected]",
"issues": "https://github.com/Wisembly/Totem/issues",
"source": "https://github.com/Wisembly/Totem"
},
Expand All @@ -32,15 +31,22 @@
},

"require": {
"php": "^7.0",
"php": "^7.1",
"php-ds/php-ds": "^1.0"
},

"require-dev": {
"symfony/property-access": "^3.0"
},

"suggest": {
"symfony/property-access": "Allows to use the collection snapshotter"
},

"extra": {
"branch-alias": {
"dev-master": "2.0-dev",
"dev-1.x": "1.5-dev"
}
}
}

6 changes: 5 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
</testsuites>

<filter>
<whitelist>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>

<exclude>
<directory suffix="Exception.php">./src</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
Expand Down
197 changes: 0 additions & 197 deletions src/AbstractSnapshot.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/AbstractChange.php → src/Change.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author Baptiste Clavié <[email protected]>
* @author Rémy Gazelot <[email protected]>
*/
abstract class AbstractChange implements ChangeInterface
class Change
{
/** old state */
private $old;
Expand Down
17 changes: 5 additions & 12 deletions src/Change/Addition.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,24 @@

namespace Totem\Change;

use Totem\ChangeInterface;
use BadMethodCallException;
use Totem\Change;

/**
* Represents something that was added in the original data
*
* @author Baptiste Clavié <[email protected]>
*/
final class Addition implements ChangeInterface
final class Addition extends Change
{
/** @var mixed */
private $new;

public function __construct($new)
{
$this->new = $new;
parent::__construct(null, $new);
}

public function getOld()
{
return null;
}

public function getNew()
{
return $this->new;
throw new BadMethodCallException('An addition does not have an old state');
}
}

45 changes: 0 additions & 45 deletions src/Change/Modification.php

This file was deleted.

17 changes: 5 additions & 12 deletions src/Change/Removal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,24 @@

namespace Totem\Change;

use Totem\ChangeInterface;
use BadMethodCallException;
use Totem\Change;

/**
* Represents something that was removed from the original data
*
* @author Baptiste Clavié <[email protected]>
*/
final class Removal implements ChangeInterface
final class Removal extends Change
{
/** @var mixed */
private $old;

public function __construct($old)
{
$this->old = $old;
parent::__construct($old, null);
}

public function getNew()
{
return null;
}

public function getOld()
{
return $this->old;
throw new BadMethodCallException('A removal does not have a new state');
}
}

Loading