diff --git a/composer.json b/composer.json index 94f863f..0490f60 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "cs:fix": "php-cs-fixer fix", "psalm": "psalm --threads=1 --no-cache", "test:unit": "phpunit tests -c tests/phpunit.xml --colors=always --fail-on-warning --fail-on-risky", - "openapi": "generate-spec" + "openapi": "generate-spec", + "rector": "rector && composer cs:fix" }, "require": { "bamarni/composer-bin-plugin": "^1.8", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..32a7586 --- /dev/null +++ b/rector.php @@ -0,0 +1,30 @@ +withPaths([ + __DIR__ . '/lib', + __DIR__ . '/tests', + ]) + ->withPhpSets(php80: true) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + codingStyle: true, + typeDeclarations: true, + privatization: true, + instanceOf: true, + earlyReturn: true, + strictBooleans: true, + carbon: true, + rectorPreset: true, + phpunitCodeQuality: true, + doctrineCodeQuality: true, + symfonyCodeQuality: true, + symfonyConfigs: true, + twig: true, + phpunit: true, + ); diff --git a/tests/unit/Controller/ApiTest.php b/tests/unit/Controller/ApiTest.php index 23537f6..0bb8a45 100644 --- a/tests/unit/Controller/ApiTest.php +++ b/tests/unit/Controller/ApiTest.php @@ -9,8 +9,8 @@ use OCA\AppTemplate\Controller\ApiController; use OCP\IRequest; use PHPUnit\Framework\TestCase; -class ApiTest extends TestCase { - public function testIndex() { +final class ApiTest extends TestCase { + public function testIndex(): void { $request = $this->createMock(IRequest::class); $controller = new ApiController(Application::APP_ID, $request); diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json new file mode 100644 index 0000000..a266a58 --- /dev/null +++ b/vendor-bin/rector/composer.json @@ -0,0 +1,5 @@ +{ + "require-dev": { + "rector/rector": "^1.2" + } +} diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock new file mode 100644 index 0000000..94ed8dc --- /dev/null +++ b/vendor-bin/rector/composer.lock @@ -0,0 +1,136 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "eb58f3061bde78d58fa424c73947025f", + "packages": [], + "packages-dev": [ + { + "name": "phpstan/phpstan", + "version": "1.12.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd", + "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-09-19T07:58:01+00:00" + }, + { + "name": "rector/rector", + "version": "1.2.5", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339", + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.12.2" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/1.2.5" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2024-09-08T17:43:24+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +}