Skip to content
This repository has been archived by the owner on May 3, 2018. It is now read-only.

Update dependencies #4

Merged
merged 6 commits into from
Apr 15, 2018
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
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/infection.json.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
7 changes: 6 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ build:
tests:
override:
- php-scrutinizer-run
- phpcs-run

dependencies:
override:
- composer install --no-interaction --prefer-dist

checks:
php : true
php: true

tools:
external_code_coverage: true
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- stage: Code Quality
env: STATIC_ANALYSIS=1
script:
- ./vendor/bin/phpstan analyse -c phpstan.neon -l max src tests
- ./vendor/bin/phpstan analyse

- stage: Code Quality
env: MUTATION_TESTS=1
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"psr/http-message": "^1.0"
},
"require-dev": {
"doctrine/coding-standard": "^3.0",
"infection/infection": "^0.7",
"phpstan/phpstan": "^0.9",
"phpstan/phpstan-phpunit": "^0.9",
"phpunit/phpunit": "^7.0",
"doctrine/coding-standard": "^4.0",
"infection/infection": "^0.8",
"phpstan/phpstan": "^0.10@dev",
"phpstan/phpstan-phpunit": "^0.10@dev",
"phpstan/phpstan-strict-rules": "^0.10@dev",
"phpunit/phpunit": "^7.1",
"squizlabs/php_codesniffer": "^3.2"
},
"autoload": {
Expand Down
6 changes: 2 additions & 4 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"timeout": 1,
"source": {
"directories": [
"src"
]
"directories": ["src"]
},
"logs": {
"text": "infection-log.txt"
}
}
}
6 changes: 5 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<file>src</file>
<file>tests</file>

<rule ref="Doctrine" />
<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment" />
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
Expand All @@ -25,4 +27,6 @@
<property name="spacesCountBeforeColon" value="0"/>
</properties>
</rule>

<rule ref="SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment" />
</ruleset>
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon

parameters:
level: 7
paths:
- src
- tests
8 changes: 6 additions & 2 deletions src/MessageCreator/NamedConstructorCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

use Lcobucci\Chimera\MessageCreator;
use Psr\Http\Message\ServerRequestInterface;
use function call_user_func;
use function assert;
use function is_callable;

/**
* The most simple message creation strategy: named constructor in the message itself
Expand All @@ -26,6 +27,9 @@ public function __construct(string $methodName = self::DEFAULT_CONSTRUCTOR)

public function create(string $message, ServerRequestInterface $request): object
{
return call_user_func([$message, $this->methodName], $request);
$callback = [$message, $this->methodName];
assert(is_callable($callback));

return $callback($request);
}
}
2 changes: 0 additions & 2 deletions tests/MessageCreator/NamedConstructorCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function createShouldUseDefaultCallbackToCreateTheMessageWhenNothingIsPro

$creator = new NamedConstructorCreator();

/** @var DoStuff $message */
$message = $creator->create(DoStuff::class, $request);

self::assertInstanceOf(DoStuff::class, $message);
Expand All @@ -47,7 +46,6 @@ public function createShouldUseACustomisedConstructorWhenItWasConfigured(): void
$request = $this->createMock(ServerRequestInterface::class);
$creator = new NamedConstructorCreator('aCustomName');

/** @var DoStuff $message */
$message = $creator->create(DoStuff::class, $request);

self::assertInstanceOf(DoStuff::class, $message);
Expand Down
3 changes: 1 addition & 2 deletions tests/ReadModelConverter/CallbackConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function convertShouldUseTheQueryCallbackToCreateASingleReadModel(): void
$converter = new CallbackConverter();
$domainObj = new AmazingDomainObject(1, 'Test');

/** @var AmazingDto $result */
$result = $converter->convert(new AmazingFetchStuff(1), $domainObj);

self::assertInstanceOf(AmazingDto::class, $result);
Expand All @@ -63,9 +62,9 @@ public function convertShouldUseTheQueryCallbackToCreateMultipleReadModels(): vo
$converter = new CallbackConverter();
$domainObj = new AmazingDomainObject(1, 'Test');

/** @var AmazingDto[] $result */
$result = $converter->convert(new AmazingFetchStuff(1), [$domainObj]);

self::assertInternalType('array', $result);
self::assertContainsOnlyInstancesOf(AmazingDto::class, $result);
self::assertCount(1, $result);
}
Expand Down