Update phpunit, phpbench, easy coding standard (#415)

This commit is contained in:
Marcin Michalski 2019-11-08 15:28:42 +01:00 committed by Arkadiusz Kondas
parent 7d5c6b15a4
commit 0d59441329
9 changed files with 971 additions and 964 deletions

View File

@ -23,13 +23,12 @@
"php": "^7.2"
},
"require-dev": {
"phpbench/phpbench": "^0.14.0",
"phpbench/phpbench": "^0.16.0",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpunit/phpunit": "^8.0",
"symplify/coding-standard": "^5.1",
"symplify/easy-coding-standard": "^5.1"
"symplify/easy-coding-standard": "^6.0"
},
"config": {
"preferred-install": "dist",

1896
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
imports:
- { resource: 'vendor/symplify/easy-coding-standard/config/psr2.yml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/php71.yml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/clean-code.yml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/common.yml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/psr2.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/php71.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/common.yaml' }
services:
# spacing

View File

@ -201,7 +201,7 @@ class Matrix
*/
public function add(self $other): self
{
return $this->_add($other);
return $this->sum($other);
}
/**
@ -209,7 +209,7 @@ class Matrix
*/
public function subtract(self $other): self
{
return $this->_add($other, -1);
return $this->sum($other, -1);
}
public function inverse(): self
@ -297,7 +297,7 @@ class Matrix
/**
* Element-wise addition or substraction depending on the given sign parameter
*/
private function _add(self $other, int $sign = 1): self
private function sum(self $other, int $sign = 1): self
{
$a1 = $this->toArray();
$a2 = $other->toArray();

View File

@ -32,8 +32,8 @@ class ModelManager
throw new FileException(sprintf('File "%s" cannot be opened.', basename($filepath)));
}
$object = unserialize((string) file_get_contents($filepath), [Estimator::class]);
if ($object === false) {
$object = unserialize((string) file_get_contents($filepath));
if ($object === false || !$object instanceof Estimator) {
throw new SerializeException(sprintf('"%s" cannot be unserialized.', basename($filepath)));
}

View File

@ -121,7 +121,9 @@ class BaggingTest extends TestCase
protected function getAvailableBaseClassifiers(): array
{
return [
DecisionTree::class => ['depth' => 5],
DecisionTree::class => [
'depth' => 5,
],
NaiveBayes::class => [],
];
}

View File

@ -61,6 +61,10 @@ class RandomForestTest extends BaggingTest
protected function getAvailableBaseClassifiers(): array
{
return [DecisionTree::class => ['depth' => 5]];
return [
DecisionTree::class => [
'depth' => 5,
],
];
}
}

View File

@ -41,11 +41,9 @@ class SynapseTest extends TestCase
}
/**
* @param int|float $output
*
* @return Neuron|MockObject
*/
private function getNodeMock($output = 1)
private function getNodeMock(float $output = 1.)
{
$node = $this->getMockBuilder(Neuron::class)->getMock();
$node->method('getOutput')->willReturn($output);

View File

@ -56,7 +56,7 @@ class NeuronTest extends TestCase
/**
* @return Synapse|MockObject
*/
private function getSynapseMock(int $output = 2)
private function getSynapseMock(float $output = 2.)
{
$synapse = $this->getMockBuilder(Synapse::class)->disableOriginalConstructor()->getMock();
$synapse->method('getOutput')->willReturn($output);