Skip to content

Commit

Permalink
Merge pull request #7 from basz/update-cs-headers
Browse files Browse the repository at this point in the history
Update cs headers
  • Loading branch information
prolic committed Nov 2, 2018
2 parents 187280e + 8964c2b commit 911a23e
Show file tree
Hide file tree
Showing 36 changed files with 186 additions and 155 deletions.
8 changes: 4 additions & 4 deletions .docheader
@@ -1,8 +1,8 @@
/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of %package%.
* (c) 2017-%year% Michiel Rook <mrook@php.net>
* (c) 2017-%year% prooph software GmbH <contact@prooph.de>
* (c) 2017-%year% Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -33,7 +33,6 @@ before_script:
script:
- if [[ $TEST_COVERAGE == 'true' ]]; then php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/docheader check src/ tests/; fi

after_success:
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/coveralls -v; fi
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Expand Up @@ -35,10 +35,9 @@
"phpunit/phpunit": "v6.2.1"
},
"require-dev": {
"malukenho/docheader": "^0.1.4",
"prooph/bookdown-template": "^0.2.3",
"prooph/event-store-bus-bridge": "^3.0",
"prooph/php-cs-fixer-config": "^0.2.1",
"prooph/php-cs-fixer-config": "^0.3",
"satooshi/php-coveralls": "^1.0"
},
"autoload": {
Expand Down
9 changes: 5 additions & 4 deletions example/TodoItem.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions example/example.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/AggregateCommandHandler.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/AggregateConstructorCommandHandler.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/AggregateIdentifier.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
11 changes: 6 additions & 5 deletions src/AggregateLifecycle.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -25,7 +26,7 @@ public static function recordThat(AggregateChanged $e)
$instance = AggregateManager::getInstance($e->aggregateId());

if ($instance === null) {
throw new \RuntimeException(sprintf('Did not find an aggregate root for id %s', $e->aggregateId()));
throw new \RuntimeException(\sprintf('Did not find an aggregate root for id %s', $e->aggregateId()));
}

$instance->doRecordThat($e);
Expand Down
11 changes: 6 additions & 5 deletions src/AggregateManager.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -49,7 +50,7 @@ public static function newInstance(callable $factoryMethod): AnnotatedAggregate
$aggregateId = $wrapper->getAggregateId();

if (isset(static::$managedAggregates[$aggregateId])) {
throw new \RuntimeException(sprintf('Already have a managed aggregate for aggregate id %s', $aggregateId));
throw new \RuntimeException(\sprintf('Already have a managed aggregate for aggregate id %s', $aggregateId));
}

static::$managedAggregates[$aggregateId] = $wrapper;
Expand Down
17 changes: 9 additions & 8 deletions src/AnnotatedAggregate.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -72,7 +73,7 @@ public function registerAggregate($aggregate)
protected function apply(AggregateChanged $e)
{
if ($this->aggregate !== null) {
$invoker = $this->inspector->getEventHandler(get_class($e));
$invoker = $this->inspector->getEventHandler(\get_class($e));
if ($invoker !== null) {
$invoker($e);
}
Expand All @@ -94,13 +95,13 @@ public function getVersion(): int
*/
public function getAggregateId()
{
$properties = AnnotationUtils::getAnnotatedProperties(get_class($this->aggregate), AggregateIdentifier::class);
$properties = AnnotationUtils::getAnnotatedProperties(\get_class($this->aggregate), AggregateIdentifier::class);

if (empty($properties)) {
throw new \RuntimeException(sprintf('Missing AggregateIdentifier annotation on aggregate root %s', get_class($this->aggregate)));
throw new \RuntimeException(\sprintf('Missing AggregateIdentifier annotation on aggregate root %s', \get_class($this->aggregate)));
}

$property = reset($properties);
$property = \reset($properties);
$property->setAccessible(true);

return $property->getValue($this->aggregate);
Expand Down
9 changes: 5 additions & 4 deletions src/AnnotatedAggregateTranslator.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/AnnotatedCommandHandler.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
21 changes: 11 additions & 10 deletions src/AnnotatedCommandTargetResolver.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -25,27 +26,27 @@ class AnnotatedCommandTargetResolver implements CommandTargetResolver
*/
public function resolveTarget(Command $command): string
{
$methods = AnnotationUtils::getAnnotatedMethods(get_class($command), TargetAggregateIdentifier::class);
$methods = AnnotationUtils::getAnnotatedMethods(\get_class($command), TargetAggregateIdentifier::class);

if (count($methods) > 0) {
if (\count($methods) > 0) {
return $methods[0]->invoke($command);
}

$properties = AnnotationUtils::getAnnotatedProperties(get_class($command), TargetAggregateIdentifier::class);
$properties = AnnotationUtils::getAnnotatedProperties(\get_class($command), TargetAggregateIdentifier::class);

if (count($properties) > 0) {
if (\count($properties) > 0) {
$property = $properties[0];
$property->setAccessible(true);

return $property->getValue($command);
}

throw new InvalidArgumentException(
sprintf(
\sprintf(
'Invalid command. It does not identify the target aggregate. ' .
'Make sure at least one of the properties or methods in the [%s] class contains the ' .
'@TargetAggregateIdentifier annotation and that it returns a non-null value.',
get_class($command)
\get_class($command)
)
);
}
Expand Down
9 changes: 5 additions & 4 deletions src/AnnotatedEventRouter.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/AnnotatedHandlerInvoker.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
13 changes: 7 additions & 6 deletions src/AnnotationUtils.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -41,7 +42,7 @@ protected function __construct(Reader $annotationReader)
public static function getInstance(): self
{
AnnotationRegistry::registerLoader(function ($name) {
if (strpos($name, 'Prooph\\Annotation') === 0) {
if (\strpos($name, 'Prooph\\Annotation') === 0) {
return true;
}

Expand All @@ -61,7 +62,7 @@ public static function getInstance(): self
*/
public static function getAnnotatedMethods($className, $annotation): array
{
return array_map(function ($methodWithAnnotation) {
return \array_map(function ($methodWithAnnotation) {
return $methodWithAnnotation[0];
}, self::getAnnotatedMethodsWithAttributes($className, $annotation));
}
Expand Down
9 changes: 5 additions & 4 deletions src/CommandHandler.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/CommandTargetResolver.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/EventHandler.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 5 additions & 4 deletions src/EventSourcingRepository.php
@@ -1,9 +1,10 @@
<?php

/**
* This file is part of the prooph/annotations package.
* (c) 2017 Michiel Rook <mrook@php.net>
* (c) 2017 prooph software GmbH <contact@prooph.de>
* (c) 2017 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
* This file is part of prooph/annotations.
* (c) 2017-2018 Michiel Rook <mrook@php.net>
* (c) 2017-2018 prooph software GmbH <contact@prooph.de>
* (c) 2017-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down

0 comments on commit 911a23e

Please sign in to comment.