PSR1, PSR2 and PSR12 code standards

This commit is contained in:
Jens True 2024-01-31 14:15:55 +00:00
parent 51a73ead83
commit f9e3b344d6
5 changed files with 56 additions and 69 deletions

@ -24,7 +24,7 @@
"scripts": {
"test": "vendor/bin/phpunit tests --display-warnings",
"test-coverage": "vendor/bin/phpunit tests --testdox --coverage-filter src --coverage-html output/coverage --coverage-text --testdox-html output/test.html --log-junit output/test.xml",
"document": "./phpDocumentor.phar",
"document": "phpDocumentor --setting=graphs.enabled=true",
"analyze": [
"@analyze-phpstan",
"@analyze-psalm",
@ -32,6 +32,6 @@
],
"analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw",
"analyze-psalm": "vendor/bin/psalm --no-cache",
"analyze-phpcs": "vendor/bin/phpcs --report=emacs --standard=PSR12 --exclude=Generic.Files.LineLength src tests"
"analyze-phpcs": "vendor/bin/phpcs --report=emacs --standard=PSR1,PSR2,PSR12 --exclude=Generic.Files.LineLength src tests"
}
}

94
composer.lock generated

@ -430,16 +430,16 @@
},
{
"name": "doctrine/deprecations",
"version": "1.1.2",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931"
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
"shasum": ""
},
"require": {
@ -471,9 +471,9 @@
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/1.1.2"
"source": "https://github.com/doctrine/deprecations/tree/1.1.3"
},
"time": "2023-09-27T20:04:15+00:00"
"time": "2024-01-30T19:34:25+00:00"
},
{
"name": "felixfbecker/advanced-json-rpc",
@ -698,16 +698,16 @@
},
{
"name": "netresearch/jsonmapper",
"version": "v4.2.0",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/cweiske/jsonmapper.git",
"reference": "f60565f8c0566a31acf06884cdaa591867ecc956"
"reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/f60565f8c0566a31acf06884cdaa591867ecc956",
"reference": "f60565f8c0566a31acf06884cdaa591867ecc956",
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/132c75c7dd83e45353ebb9c6c9f591952995bbf0",
"reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0",
"shasum": ""
},
"require": {
@ -718,7 +718,7 @@
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "~7.5 || ~8.0 || ~9.0",
"phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0",
"squizlabs/php_codesniffer": "~3.5"
},
"type": "library",
@ -743,9 +743,9 @@
"support": {
"email": "cweiske@cweiske.de",
"issues": "https://github.com/cweiske/jsonmapper/issues",
"source": "https://github.com/cweiske/jsonmapper/tree/v4.2.0"
"source": "https://github.com/cweiske/jsonmapper/tree/v4.4.1"
},
"time": "2023-04-09T17:37:40+00:00"
"time": "2024-01-31T06:18:54+00:00"
},
{
"name": "nikic/php-parser",
@ -1131,16 +1131,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.56",
"version": "1.10.57",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "27816a01aea996191ee14d010f325434c0ee76fa"
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa",
"reference": "27816a01aea996191ee14d010f325434c0ee76fa",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
"shasum": ""
},
"require": {
@ -1189,7 +1189,7 @@
"type": "tidelift"
}
],
"time": "2024-01-15T10:43:00+00:00"
"time": "2024-01-24T11:51:34+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -1514,16 +1514,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.5.8",
"version": "10.5.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e"
"reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/08f4fa74d5fbfff1ef22abffee47aaedcaea227e",
"reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe",
"reference": "0bd663704f0165c9e76fe4f06ffa6a1ca727fdbe",
"shasum": ""
},
"require": {
@ -1595,7 +1595,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.8"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.9"
},
"funding": [
{
@ -1611,7 +1611,7 @@
"type": "tidelift"
}
],
"time": "2024-01-19T07:07:27+00:00"
"time": "2024-01-22T14:35:40+00:00"
},
{
"name": "psr/container",
@ -2776,16 +2776,16 @@
},
{
"name": "symfony/console",
"version": "v7.0.2",
"version": "v7.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "f8587c4cdc5acad67af71c37db34ef03af91e59c"
"reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/f8587c4cdc5acad67af71c37db34ef03af91e59c",
"reference": "f8587c4cdc5acad67af71c37db34ef03af91e59c",
"url": "https://api.github.com/repos/symfony/console/zipball/c5010d50f1ee4b25cfa0201d9915cf1b14071456",
"reference": "c5010d50f1ee4b25cfa0201d9915cf1b14071456",
"shasum": ""
},
"require": {
@ -2849,7 +2849,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.0.2"
"source": "https://github.com/symfony/console/tree/v7.0.3"
},
"funding": [
{
@ -2865,20 +2865,20 @@
"type": "tidelift"
}
],
"time": "2023-12-10T16:54:46+00:00"
"time": "2024-01-23T15:02:46+00:00"
},
{
"name": "symfony/filesystem",
"version": "v7.0.0",
"version": "v7.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7"
"reference": "2890e3a825bc0c0558526c04499c13f83e1b6b12"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/2890e3a825bc0c0558526c04499c13f83e1b6b12",
"reference": "2890e3a825bc0c0558526c04499c13f83e1b6b12",
"shasum": ""
},
"require": {
@ -2912,7 +2912,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v7.0.0"
"source": "https://github.com/symfony/filesystem/tree/v7.0.3"
},
"funding": [
{
@ -2928,7 +2928,7 @@
"type": "tidelift"
}
],
"time": "2023-07-27T06:33:22+00:00"
"time": "2024-01-23T15:02:46+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -3344,16 +3344,16 @@
},
{
"name": "symfony/string",
"version": "v7.0.2",
"version": "v7.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "cc78f14f91f5e53b42044d0620961c48028ff9f5"
"reference": "524aac4a280b90a4420d8d6a040718d0586505ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/cc78f14f91f5e53b42044d0620961c48028ff9f5",
"reference": "cc78f14f91f5e53b42044d0620961c48028ff9f5",
"url": "https://api.github.com/repos/symfony/string/zipball/524aac4a280b90a4420d8d6a040718d0586505ac",
"reference": "524aac4a280b90a4420d8d6a040718d0586505ac",
"shasum": ""
},
"require": {
@ -3410,7 +3410,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.0.2"
"source": "https://github.com/symfony/string/tree/v7.0.3"
},
"funding": [
{
@ -3426,7 +3426,7 @@
"type": "tidelift"
}
],
"time": "2023-12-10T16:54:46+00:00"
"time": "2024-01-29T15:41:16+00:00"
},
{
"name": "theseer/tokenizer",
@ -3480,16 +3480,16 @@
},
{
"name": "vimeo/psalm",
"version": "5.20.0",
"version": "5.21.0",
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
"reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4"
"reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/3f284e96c9d9be6fe6b15c79416e1d1903dcfef4",
"reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f",
"reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f",
"shasum": ""
},
"require": {
@ -3586,7 +3586,7 @@
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm"
},
"time": "2024-01-18T12:15:06+00:00"
"time": "2024-01-30T22:52:27+00:00"
},
{
"name": "webmozart/assert",

@ -74,16 +74,8 @@ class Matrix
$transposeMatrix = [];
$rowMatrixData = $this->matrixRowData;
for (
$currentRowTransposeMatrix = 0;
$currentRowTransposeMatrix < $this->columnCount;
$currentRowTransposeMatrix++
) {
for (
$currentColumnTransposeMatrix = 0;
$currentColumnTransposeMatrix < $this->rowCount;
$currentColumnTransposeMatrix++
) {
for ($currentRowTransposeMatrix = 0; $currentRowTransposeMatrix < $this->columnCount; $currentRowTransposeMatrix++) {
for ($currentColumnTransposeMatrix = 0; $currentColumnTransposeMatrix < $this->rowCount; $currentColumnTransposeMatrix++) {
$transposeMatrix[$currentRowTransposeMatrix][$currentColumnTransposeMatrix] =
$rowMatrixData[$currentColumnTransposeMatrix][$currentRowTransposeMatrix];
}
@ -214,11 +206,7 @@ class Matrix
public static function add(Matrix $left, Matrix $right): Matrix
{
if (
($left->getRowCount() != $right->getRowCount())
|| ($left->getColumnCount() != $right->getColumnCount())
) {
if (($left->getRowCount() != $right->getRowCount()) || ($left->getColumnCount() != $right->getColumnCount())) {
throw new Exception('Matrices must be of the same size');
}

@ -79,11 +79,7 @@ class GaussianWeightedSumFactor extends GaussianFactor
// This is helpful since we skip over one of the spots
$currentDestinationWeightIndex = 0;
for (
$currentWeightSourceIndex = 0;
$currentWeightSourceIndex < $variableWeightsLength;
$currentWeightSourceIndex++
) {
for ($currentWeightSourceIndex = 0; $currentWeightSourceIndex < $variableWeightsLength; $currentWeightSourceIndex++) {
if ($currentWeightSourceIndex === $weightsIndex - 1) {
continue;
}

@ -2,6 +2,9 @@
namespace DNW\Skills\Tests;
/**
* Empty wrapper for Unittests
*/
class TestCase extends \PHPUnit\Framework\TestCase
{
}