diff --git a/examples/quickstart.php b/examples/quickstart.php index 7a9c67b..b128459 100644 --- a/examples/quickstart.php +++ b/examples/quickstart.php @@ -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 { @@ -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; } @@ -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] )); } } @@ -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(); - } /** @@ -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(); -} \ No newline at end of file +} diff --git a/src/Prooph/EventSourcing/AggregateChanged.php b/src/Prooph/EventSourcing/AggregateChanged.php index c389036..39d78f4 100644 --- a/src/Prooph/EventSourcing/AggregateChanged.php +++ b/src/Prooph/EventSourcing/AggregateChanged.php @@ -13,7 +13,7 @@ /** * AggregateChanged - * + * * @author Alexander Miertsch * @package Prooph\EventSourcing */ diff --git a/src/Prooph/EventSourcing/AggregateRoot.php b/src/Prooph/EventSourcing/AggregateRoot.php index ad1e125..5dd4c84 100644 --- a/src/Prooph/EventSourcing/AggregateRoot.php +++ b/src/Prooph/EventSourcing/AggregateRoot.php @@ -10,7 +10,7 @@ /** * AggregateRoot - * + * * @author Alexander Miertsch * * @package Prooph\EventSourcing @@ -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 @@ -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; } @@ -120,7 +120,7 @@ protected function apply(AggregateChanged $e) get_class($this) )); } - + $this->{$handler}($e); } @@ -133,6 +133,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)); } } diff --git a/src/Prooph/EventSourcing/EventStoreIntegration/AggregateRootDecorator.php b/src/Prooph/EventSourcing/EventStoreIntegration/AggregateRootDecorator.php index d41ff3c..a00ced0 100644 --- a/src/Prooph/EventSourcing/EventStoreIntegration/AggregateRootDecorator.php +++ b/src/Prooph/EventSourcing/EventStoreIntegration/AggregateRootDecorator.php @@ -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 */ @@ -70,4 +70,3 @@ protected function aggregateId() throw new \BadMethodCallException("The AggregateRootDecorator does not have an id"); } } - \ No newline at end of file diff --git a/src/Prooph/EventSourcing/EventStoreIntegration/AggregateTranslator.php b/src/Prooph/EventSourcing/EventStoreIntegration/AggregateTranslator.php index ff2f3eb..64f0387 100644 --- a/src/Prooph/EventSourcing/EventStoreIntegration/AggregateTranslator.php +++ b/src/Prooph/EventSourcing/EventStoreIntegration/AggregateTranslator.php @@ -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 */ @@ -87,4 +87,3 @@ public function setAggregateRootDecorator(AggregateRootDecorator $anAggregateRoo $this->aggregateRootDecorator = $anAggregateRootDecorator; } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/AggregateChangedTest.php b/tests/Prooph/EventSourcingTest/AggregateChangedTest.php index 409de46..dd950c5 100644 --- a/tests/Prooph/EventSourcingTest/AggregateChangedTest.php +++ b/tests/Prooph/EventSourcingTest/AggregateChangedTest.php @@ -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 */ @@ -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()); } @@ -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()); } @@ -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()); } @@ -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); @@ -68,7 +68,7 @@ public function it_has_assigned_payload_after_construct() */ public function it_can_track_aggregate_version() { - $event = AggregateChanged::occur('1', array('key' => 'value')); + $event = AggregateChanged::occur('1', ['key' => 'value']); $event->trackVersion(2); @@ -80,7 +80,7 @@ public function it_can_track_aggregate_version() */ public function it_only_tracks_version_once() { - $event = AggregateChanged::occur('1', array('key' => 'value')); + $event = AggregateChanged::occur('1', ['key' => 'value']); $event->trackVersion(2); @@ -89,4 +89,3 @@ public function it_only_tracks_version_once() $event->trackVersion(3); } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/AggregateRootTest.php b/tests/Prooph/EventSourcingTest/AggregateRootTest.php index f0dc305..f55489e 100644 --- a/tests/Prooph/EventSourcingTest/AggregateRootTest.php +++ b/tests/Prooph/EventSourcingTest/AggregateRootTest.php @@ -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 */ @@ -84,4 +84,3 @@ public function it_clears_pending_events_after_returning_them() $this->assertEquals(0, count($recordedEvens)); } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/EventStoreIntegration/AggregateTranslatorTest.php b/tests/Prooph/EventSourcingTest/EventStoreIntegration/AggregateTranslatorTest.php index f012d27..4998b66 100644 --- a/tests/Prooph/EventSourcingTest/EventStoreIntegration/AggregateTranslatorTest.php +++ b/tests/Prooph/EventSourcingTest/EventStoreIntegration/AggregateTranslatorTest.php @@ -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 */ @@ -51,7 +51,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(); @@ -90,4 +90,3 @@ protected function resetRepository() ); } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/Mock/User.php b/tests/Prooph/EventSourcingTest/Mock/User.php index 871144d..087c6d8 100644 --- a/tests/Prooph/EventSourcingTest/Mock/User.php +++ b/tests/Prooph/EventSourcingTest/Mock/User.php @@ -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 */ @@ -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; } @@ -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])); } /** @@ -108,4 +108,3 @@ protected function aggregateId() return $this->id(); } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/Mock/UserCreated.php b/tests/Prooph/EventSourcingTest/Mock/UserCreated.php index dc16a1f..badd64b 100644 --- a/tests/Prooph/EventSourcingTest/Mock/UserCreated.php +++ b/tests/Prooph/EventSourcingTest/Mock/UserCreated.php @@ -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 */ @@ -37,4 +37,3 @@ public function name() return $this->payload['name']; } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/Mock/UserNameChanged.php b/tests/Prooph/EventSourcingTest/Mock/UserNameChanged.php index 1d05abf..4f6336d 100644 --- a/tests/Prooph/EventSourcingTest/Mock/UserNameChanged.php +++ b/tests/Prooph/EventSourcingTest/Mock/UserNameChanged.php @@ -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 */ @@ -29,4 +29,3 @@ public function newUsername() return $this->payload['username']; } } - \ No newline at end of file diff --git a/tests/Prooph/EventSourcingTest/TestCase.php b/tests/Prooph/EventSourcingTest/TestCase.php index f3f0b3f..cf23682 100644 --- a/tests/Prooph/EventSourcingTest/TestCase.php +++ b/tests/Prooph/EventSourcingTest/TestCase.php @@ -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 * @@ -26,4 +20,3 @@ class TestCase extends \PHPUnit_Framework_TestCase { } - \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b4987b0..5417d59 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -5,9 +5,9 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * + * * Date: 08.03.14 - 15:47 */ require_once __DIR__ . '/../vendor/autoload.php'; -chdir(__DIR__); \ No newline at end of file +chdir(__DIR__);