Skip to content

Commit

Permalink
Make PHP 7.1 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Szurovecz committed Mar 14, 2018
1 parent 31a6318 commit 6e892bf
Show file tree
Hide file tree
Showing 207 changed files with 751 additions and 4,590 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,9 +1,8 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.1
- 7.2

before_script:
- wget http://getcomposer.org/composer.phar
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2012-2014 Janos Szurovecz
Copyright (c) 2018 Janos Szurovecz

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -10,17 +10,17 @@
}
],
"require": {
"php": ">=5.4",
"precore/precore": "~1.9 || ^2.0",
"php": ">=7.1",
"precore/precore": "dev-feature/make-php-7-1-compatible",
"doctrine/annotations": "~1.1",
"doctrine/cache": "~1.0",
"lf4php/lf4php": "~4.2",
"trf4php/trf4php": "~1.1"
},
"require-dev": {
"mf4php/mf4php": "~1.1",
"satooshi/php-coveralls": "~1.0",
"phpunit/phpunit": "~4.1",
"satooshi/php-coveralls": "~2.0",
"phpunit/phpunit": "7.0.2",
"lf4php/lf4php-log4php": "~2.1",
"jms/serializer": "~0.15"
},
Expand Down
29 changes: 5 additions & 24 deletions src/predaddy/commandhandling/AbstractCommand.php
@@ -1,28 +1,9 @@
<?php
/*
* Copyright (c) 2013 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

use precore\util\ToStringHelper;
use predaddy\domain\StateHashAware;
use predaddy\messagehandling\AbstractMessage;

Expand All @@ -41,7 +22,7 @@ abstract class AbstractCommand extends AbstractMessage implements Command
/**
* @param string|null $aggregateId
*/
public function __construct($aggregateId = null)
public function __construct(string $aggregateId = null)
{
parent::__construct();
$this->aggregateId = $aggregateId;
Expand All @@ -50,12 +31,12 @@ public function __construct($aggregateId = null)
/**
* @return null|string
*/
public function aggregateId()
public function aggregateId() : ?string
{
return $this->aggregateId;
}

protected function toStringHelper()
protected function toStringHelper() : ToStringHelper
{
$toStringHelper = parent::toStringHelper()->add('aggregateId', $this->aggregateId);
if ($this instanceof StateHashAware) {
Expand Down
28 changes: 4 additions & 24 deletions src/predaddy/commandhandling/AbstractCommandHandler.php
@@ -1,29 +1,9 @@
<?php
/*
* Copyright (c) 2012-2014 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

use precore\lang\Object;
use precore\lang\BaseObject;
use predaddy\domain\Repository;

/**
Expand All @@ -32,7 +12,7 @@
*
* @author Janos Szurovecz <szjani@szjani.hu>
*/
abstract class AbstractCommandHandler extends Object
abstract class AbstractCommandHandler extends BaseObject
{
/**
* @var Repository
Expand All @@ -47,7 +27,7 @@ public function __construct(Repository $repository)
/**
* @return Repository
*/
public function getRepository()
public function getRepository() : Repository
{
return $this->repository;
}
Expand Down
24 changes: 2 additions & 22 deletions src/predaddy/commandhandling/Command.php
@@ -1,25 +1,5 @@
<?php
/*
* Copyright (c) 2013 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

Expand All @@ -40,5 +20,5 @@ interface Command extends Message
/**
* @return string|null null if it is a create command
*/
public function aggregateId();
public function aggregateId() : ?string;
}
24 changes: 2 additions & 22 deletions src/predaddy/commandhandling/CommandBus.php
@@ -1,25 +1,5 @@
<?php
/*
* Copyright (c) 2013 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

Expand Down Expand Up @@ -56,7 +36,7 @@ public static function builder()
return new CommandBusBuilder();
}

protected function callableWrappersFor($message)
protected function callableWrappersFor($message) : \ArrayObject
{
$wrappers = parent::callableWrappersFor($message);
Preconditions::checkState(
Expand Down
29 changes: 5 additions & 24 deletions src/predaddy/commandhandling/CommandBusBuilder.php
@@ -1,29 +1,10 @@
<?php
/*
* Copyright (c) 2014 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

use predaddy\messagehandling\annotation\AnnotatedMessageHandlerDescriptorFactory;
use predaddy\messagehandling\MessageHandlerDescriptorFactory;
use predaddy\messagehandling\SimpleMessageBusBuilder;

/**
Expand All @@ -47,7 +28,7 @@ class CommandBusBuilder extends SimpleMessageBusBuilder
/**
* Should not be called!
*/
public static function init()
public static function init() : void
{
self::$defaultHandlerDescFactory = new AnnotatedMessageHandlerDescriptorFactory(
new CommandFunctionDescriptorFactory()
Expand All @@ -57,15 +38,15 @@ public static function init()
/**
* @return AnnotatedMessageHandlerDescriptorFactory
*/
protected static function defaultHandlerDescFactory()
protected static function defaultHandlerDescFactory() : MessageHandlerDescriptorFactory
{
return self::$defaultHandlerDescFactory;
}

/**
* @return string
*/
protected static function defaultName()
protected static function defaultName() : string
{
return self::DEFAULT_NAME;
}
Expand Down
26 changes: 3 additions & 23 deletions src/predaddy/commandhandling/CommandFunctionDescriptor.php
@@ -1,38 +1,18 @@
<?php
/*
* Copyright (c) 2013 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

use predaddy\messagehandling\DefaultFunctionDescriptor;

final class CommandFunctionDescriptor extends DefaultFunctionDescriptor
{
protected function getBaseMessageClassName()
protected function getBaseMessageClassName() : string
{
return __NAMESPACE__ . '\Command';
}

protected function canHandleValidMessage($object)
protected function canHandleValidMessage($object) : bool
{
return get_class($object) === $this->getHandledMessageClassName();
}
Expand Down
24 changes: 2 additions & 22 deletions src/predaddy/commandhandling/CommandFunctionDescriptorFactory.php
@@ -1,25 +1,5 @@
<?php
/*
* Copyright (c) 2013 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);
namespace predaddy\commandhandling;

use predaddy\messagehandling\CallableWrapper;
Expand All @@ -33,7 +13,7 @@ final class CommandFunctionDescriptorFactory implements FunctionDescriptorFactor
* @param int $priority
* @return FunctionDescriptor
*/
public function create(CallableWrapper $callableWrapper, $priority)
public function create(CallableWrapper $callableWrapper, int $priority) : FunctionDescriptor
{
return new CommandFunctionDescriptor($callableWrapper, $priority);
}
Expand Down
24 changes: 2 additions & 22 deletions src/predaddy/commandhandling/DirectCommand.php
@@ -1,25 +1,5 @@
<?php
/*
* Copyright (c) 2012-2014 Janos Szurovecz
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
declare(strict_types=1);

namespace predaddy\commandhandling;

Expand All @@ -37,5 +17,5 @@ interface DirectCommand extends Command
/**
* @return string
*/
public function aggregateClass();
public function aggregateClass() : string;
}

0 comments on commit 6e892bf

Please sign in to comment.