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

Fix php-cs for all files in repo #6

Merged
merged 1 commit into from
Aug 18, 2015
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
9 changes: 4 additions & 5 deletions examples/quickstart.php
Original file line number Diff line number Diff line change
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/Prooph/EventSourcing/AggregateChanged.php
Original file line number Diff line number Diff line change
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/Prooph/EventSourcing/AggregateRoot.php
Original file line number Diff line number Diff line change
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 @@ -120,7 +120,7 @@ protected function apply(AggregateChanged $e)
get_class($this)
));
}

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

Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
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 @@ -70,4 +70,3 @@ protected function aggregateId()
throw new \BadMethodCallException("The AggregateRootDecorator does not have an id");
}
}

Original file line number Diff line number Diff line change
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;
}
}

15 changes: 7 additions & 8 deletions tests/Prooph/EventSourcingTest/AggregateChangedTest.php
Original file line number Diff line number Diff line change
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,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);

Expand All @@ -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);

Expand All @@ -89,4 +89,3 @@ public function it_only_tracks_version_once()
$event->trackVersion(3);
}
}

3 changes: 1 addition & 2 deletions tests/Prooph/EventSourcingTest/AggregateRootTest.php
Original file line number Diff line number Diff line change
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 @@ -84,4 +84,3 @@ public function it_clears_pending_events_after_returning_them()
$this->assertEquals(0, count($recordedEvens));
}
}

Original file line number Diff line number Diff line change
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 @@ -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();

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

7 changes: 3 additions & 4 deletions tests/Prooph/EventSourcingTest/Mock/User.php
Original file line number Diff line number Diff line change
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/Prooph/EventSourcingTest/Mock/UserCreated.php
Original file line number Diff line number Diff line change
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/Prooph/EventSourcingTest/Mock/UserNameChanged.php
Original file line number Diff line number Diff line change
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/Prooph/EventSourcingTest/TestCase.php
Original file line number Diff line number Diff line change
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
{
}

4 changes: 2 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
chdir(__DIR__);