Add unused imports phpcs rule

This commit is contained in:
Michael Weimann 2022-04-16 10:38:28 +02:00 committed by Igor Scheller
parent c4b2fbda1a
commit 66e7a3e183
9 changed files with 196 additions and 13 deletions

View File

@ -9,4 +9,9 @@
<file>tests</file>
<rule ref="PSR12" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
</ruleset>

View File

@ -51,6 +51,7 @@
"fakerphp/faker": "^1.17",
"filp/whoops": "^2.14",
"phpunit/phpunit": "^9.5",
"slevomat/coding-standard": "^7.1",
"squizlabs/php_codesniffer": "^3.6",
"symfony/var-dumper": "^5.4"
},
@ -72,6 +73,7 @@
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true
}
},
"sort-packages": true
}
}

184
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3aff0f0cc50aa12ed22a098d3f807445",
"content-hash": "5e78f62411dd27e5217899de3d1b22be",
"packages": [
{
"name": "composer/package-versions-deprecated",
@ -4625,6 +4625,81 @@
}
],
"packages-dev": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.2",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
"reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.0"
},
"type": "composer-plugin",
"extra": {
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
},
{
"name": "Contributors",
"homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcbf",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2022-02-04T12:51:07+00:00"
},
{
"name": "dms/phpunit-arraysubset-asserts",
"version": "v0.3.1",
@ -5324,6 +5399,50 @@
},
"time": "2021-12-08T12:19:24+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.4.4",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "d8e9fd97ca11f2f24fc1aafbcfb1f78bce762267"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/d8e9fd97ca11f2f24fc1aafbcfb1f78bce762267",
"reference": "d8e9fd97ca11f2f24fc1aafbcfb1f78bce762267",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPStan\\PhpDocParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.4.4"
},
"time": "2022-04-14T12:24:06+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.10",
@ -6709,6 +6828,67 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
{
"name": "slevomat/coding-standard",
"version": "7.1",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "b521bd358b5f7a7d69e9637fd139e036d8adeb6f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/b521bd358b5f7a7d69e9637fd139e036d8adeb6f",
"reference": "b521bd358b5f7a7d69e9637fd139e036d8adeb6f",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"php": "^7.2 || ^8.0",
"phpstan/phpdoc-parser": "^1.4.1",
"squizlabs/php_codesniffer": "^3.6.2"
},
"require-dev": {
"phing/phing": "2.17.2",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phpstan/phpstan": "1.4.10|1.5.2",
"phpstan/phpstan-deprecation-rules": "1.0.0",
"phpstan/phpstan-phpunit": "1.0.0|1.1.0",
"phpstan/phpstan-strict-rules": "1.1.0",
"phpunit/phpunit": "7.5.20|8.5.21|9.5.19"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "7.x-dev"
}
},
"autoload": {
"psr-4": {
"SlevomatCodingStandard\\": "SlevomatCodingStandard"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
"source": "https://github.com/slevomat/coding-standard/tree/7.1"
},
"funding": [
{
"url": "https://github.com/kukulich",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
"type": "tidelift"
}
],
"time": "2022-03-29T12:44:16+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.6.2",
@ -6978,5 +7158,5 @@
"ext-xml": "*"
},
"platform-dev": [],
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.0.0"
}

View File

@ -3,7 +3,6 @@
namespace Engelsystem\Controllers;
use Engelsystem\Config\Config;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
use Engelsystem\Models\User\State;
use Engelsystem\Models\User\User;

View File

@ -4,8 +4,6 @@ declare(strict_types=1);
namespace Engelsystem\Helpers;
use Psr\SimpleCache\InvalidArgumentException;
class Carbon extends \Carbon\Carbon
{
public const DATETIME_LOCAL = '!Y-m-d\TH:i';

View File

@ -21,8 +21,8 @@ class DatabaseTest extends TestCase
*/
public function testInit()
{
/** @var Pdo|MockObject $pdo */
$pdo = $this->getMockBuilder(Pdo::class)
/** @var PDO|MockObject $pdo */
$pdo = $this->getMockBuilder(PDO::class)
->disableOriginalConstructor()
->getMock();

View File

@ -17,8 +17,8 @@ class DbTest extends TestCase
*/
public function testSetDbManager()
{
/** @var Pdo|MockObject $pdo */
$pdo = $this->getMockBuilder(Pdo::class)
/** @var PDO|MockObject $pdo */
$pdo = $this->getMockBuilder(PDO::class)
->disableOriginalConstructor()
->getMock();
/** @var CapsuleManager|MockObject $dbManager */

View File

@ -61,7 +61,7 @@ class ResponseTest extends TestCase
*/
public function testWithView()
{
/** @var REnderer|MockObject $renderer */
/** @var Renderer|MockObject $renderer */
$renderer = $this->createMock(Renderer::class);
$renderer->expects($this->once())
@ -77,7 +77,7 @@ class ResponseTest extends TestCase
$this->assertEquals(505, $newResponse->getStatusCode());
$this->assertArraySubset(['test' => ['er']], $newResponse->getHeaders());
/** @var REnderer|MockObject $renderer */
/** @var Renderer|MockObject $renderer */
$anotherRenderer = $this->createMock(Renderer::class);
$anotherRenderer->expects($this->once())
->method('render')

View File

@ -4,7 +4,6 @@ namespace Engelsystem\Test\Unit\Renderer\Twig\Extensions;
use Engelsystem\Renderer\Twig\Extensions\Markdown;
use Parsedown;
use PHPUnit\Framework\MockObject\MockObject;
class MarkdownTest extends ExtensionTest
{