Skip to content

Commit

Permalink
apply cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Aug 26, 2015
1 parent cd2c2d4 commit 710a0e8
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 51 deletions.
9 changes: 4 additions & 5 deletions examples/quickstart.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 07.09.14 - 20:11
*/
namespace {
Expand Down Expand Up @@ -49,7 +49,7 @@ public static function nameNew($username)
$instance = new self();

//Use AggregateRoot::recordThat method to apply a new Event
$instance->recordThat(UserWasCreated::occur($uuid->toString(), array('name' => $username)));
$instance->recordThat(UserWasCreated::occur($uuid->toString(), ['name' => $username]));

return $instance;
}
Expand Down Expand Up @@ -80,7 +80,7 @@ public function changeName($newName)
if ($newName != $this->name) {
$this->recordThat(UserWasRenamed::occur(
$this->uuid->toString(),
array('new_name' => $newName, 'old_name' => $this->name)
['new_name' => $newName, 'old_name' => $this->name]
));
}
}
Expand All @@ -97,7 +97,6 @@ protected function whenUserWasCreated(UserWasCreated $event)
//Simply assign the event payload to the appropriate properties
$this->uuid = Uuid::fromString($event->aggregateId());
$this->name = $event->username();

}

/**
Expand Down Expand Up @@ -294,4 +293,4 @@ public function get(Uuid $uuid)
//... so we only need to commit the transaction and the UserWasRenamed event should be recorded
//(check output of the previously attached listener)
$eventStore->commit();
}
}
2 changes: 1 addition & 1 deletion src/AggregateChanged.php
Expand Up @@ -13,7 +13,7 @@

/**
* AggregateChanged
*
*
* @author Alexander Miertsch <contact@prooph.de>
* @package Prooph\EventSourcing
*/
Expand Down
24 changes: 12 additions & 12 deletions src/AggregateRoot.php
Expand Up @@ -10,7 +10,7 @@

/**
* AggregateRoot
*
*
* @author Alexander Miertsch <contact@prooph.de>
*
* @package Prooph\EventSourcing
Expand All @@ -19,17 +19,17 @@ abstract class AggregateRoot
{
/**
* Current version
*
* @var float
*
* @var float
*/
protected $version = 0;

/**
* List of events that are not committed to the EventStore
*
*
* @var AggregateChanged[]
*/
protected $recordedEvents = array();
protected $recordedEvents = [];

/**
* @param AggregateChanged[] $historyEvents
Expand Down Expand Up @@ -58,15 +58,15 @@ abstract protected function aggregateId();

/**
* Get pending events and reset stack
*
*
* @return AggregateChanged[]
*/
protected function popRecordedEvents()
{
$pendingEvents = $this->recordedEvents;
$this->recordedEvents = array();

$this->recordedEvents = [];

return $pendingEvents;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ protected function apply(AggregateChanged $e)
get_class($this)
));
}

$this->{$handler}($e);
}

Expand All @@ -131,6 +131,6 @@ protected function apply(AggregateChanged $e)
*/
protected function determineEventHandlerMethodFor(AggregateChanged $e)
{
return 'when' . join('', array_slice(explode('\\', get_class($e)), -1));
return 'when' . implode('', array_slice(explode('\\', get_class($e)), -1));
}
}
3 changes: 1 addition & 2 deletions src/EventStoreIntegration/AggregateRootDecorator.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 19.04.14 - 20:24
*/

Expand Down Expand Up @@ -73,4 +73,3 @@ protected function aggregateId()
throw new \BadMethodCallException("The AggregateRootDecorator does not have an id");
}
}

3 changes: 1 addition & 2 deletions src/EventStoreIntegration/AggregateTranslator.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 05.09.14 - 23:36
*/

Expand Down Expand Up @@ -87,4 +87,3 @@ public function setAggregateRootDecorator(AggregateRootDecorator $anAggregateRoo
$this->aggregateRootDecorator = $anAggregateRootDecorator;
}
}

13 changes: 6 additions & 7 deletions tests/AggregateChangedTest.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 17.04.14 - 21:45
*/

Expand All @@ -26,7 +26,7 @@ class AggregateChangedTest extends TestCase
*/
public function it_has_a_new_uuid_after_construct()
{
$event = AggregateChanged::occur('1', array());
$event = AggregateChanged::occur('1', []);

$this->assertInstanceOf('Rhumsaa\Uuid\Uuid', $event->uuid());
}
Expand All @@ -36,7 +36,7 @@ public function it_has_a_new_uuid_after_construct()
*/
public function it_references_an_aggregate()
{
$event = AggregateChanged::occur('1', array());
$event = AggregateChanged::occur('1', []);

$this->assertEquals(1, $event->aggregateId());
}
Expand All @@ -46,7 +46,7 @@ public function it_references_an_aggregate()
*/
public function it_has_an_occurred_on_datetime_after_construct()
{
$event = AggregateChanged::occur('1', array());
$event = AggregateChanged::occur('1', []);

$this->assertInstanceOf('\DateTimeImmutable', $event->createdAt());
}
Expand All @@ -56,7 +56,7 @@ public function it_has_an_occurred_on_datetime_after_construct()
*/
public function it_has_assigned_payload_after_construct()
{
$payload = array('test payload');
$payload = ['test payload'];

$event = AggregateChanged::occur('1', $payload);

Expand All @@ -68,12 +68,11 @@ public function it_has_assigned_payload_after_construct()
*/
public function it_can_track_aggregate_version_but_is_immutable()
{
$orgEvent = AggregateChanged::occur('1', array('key' => 'value'));
$orgEvent = AggregateChanged::occur('1', ['key' => 'value']);

$newEvent = $orgEvent->withVersion(2);

$this->assertEquals(0, $orgEvent->version());
$this->assertEquals(2, $newEvent->version());
}
}

3 changes: 1 addition & 2 deletions tests/AggregateRootTest.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 18.04.14 - 00:03
*/

Expand Down Expand Up @@ -95,4 +95,3 @@ public function it_clears_pending_events_after_returning_them()
$this->assertEquals(0, count($recordedEvens));
}
}

2 changes: 1 addition & 1 deletion tests/EventStoreIntegration/AggregateRootDecoratorTest.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 08/26/15 - 20:32
*/

Expand Down
5 changes: 2 additions & 3 deletions tests/EventStoreIntegration/AggregateTranslatorTest.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 07.09.14 - 19:49
*/

Expand Down Expand Up @@ -48,7 +48,7 @@ protected function setUp()

$this->eventStore->beginTransaction();

$this->eventStore->create(new Stream(new StreamName('event_stream'), array()));
$this->eventStore->create(new Stream(new StreamName('event_stream'), []));

$this->eventStore->commit();

Expand Down Expand Up @@ -113,4 +113,3 @@ protected function resetRepository()
);
}
}

7 changes: 3 additions & 4 deletions tests/Mock/User.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 18.04.14 - 00:04
*/

Expand Down Expand Up @@ -38,7 +38,7 @@ public static function nameNew($name)
$id = Uuid::uuid4()->toString();
$instance = new self();

$instance->recordThat(UserCreated::occur($id, array('id' => $id, 'name' => $name)));
$instance->recordThat(UserCreated::occur($id, ['id' => $id, 'name' => $name]));

return $instance;
}
Expand All @@ -64,7 +64,7 @@ public function id()
*/
public function changeName($newName)
{
$this->recordThat(UserNameChanged::occur($this->id, array('username' => $newName)));
$this->recordThat(UserNameChanged::occur($this->id, ['username' => $newName]));
}

/**
Expand Down Expand Up @@ -108,4 +108,3 @@ protected function aggregateId()
return $this->id();
}
}

3 changes: 1 addition & 2 deletions tests/Mock/UserCreated.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 18.04.14 - 00:29
*/

Expand Down Expand Up @@ -37,4 +37,3 @@ public function name()
return $this->payload['name'];
}
}

3 changes: 1 addition & 2 deletions tests/Mock/UserNameChanged.php
Expand Up @@ -5,7 +5,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 18.04.14 - 00:08
*/

Expand All @@ -29,4 +29,3 @@ public function newUsername()
return $this->payload['username'];
}
}

9 changes: 1 addition & 8 deletions tests/TestCase.php
Expand Up @@ -5,18 +5,12 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*
* Date: 06.06.14 - 23:05
*/

namespace Prooph\EventSourcingTest;

use Prooph\EventSourcing\EventStoreFeature\ProophEventSourcingFeature;
use Prooph\EventStore\Adapter\Zf2\Zf2EventStoreAdapter;
use Prooph\EventStore\Configuration\Configuration;
use Prooph\EventStore\EventStore;
use Zend\Math\BigInteger\Adapter\AdapterInterface;

/**
* Class TestCase
*
Expand All @@ -26,4 +20,3 @@
class TestCase extends \PHPUnit_Framework_TestCase
{
}

0 comments on commit 710a0e8

Please sign in to comment.