Quality of life. Removing a lot of requirements etc
This commit is contained in:
		| @@ -24,12 +24,7 @@ | |||||||
|     }, |     }, | ||||||
|     "require-dev": { |     "require-dev": { | ||||||
|         "phpunit/phpunit": "^10.3.5", |         "phpunit/phpunit": "^10.3.5", | ||||||
|         "phpmetrics/phpmetrics": "^3.0-dev", |         "phpmetrics/phpmetrics": "^3.0-dev" | ||||||
|         "rector/rector": "^1.0", |  | ||||||
|         "vimeo/psalm": "dev-master", |  | ||||||
|         "phpmd/phpmd": "^2.15", |  | ||||||
|         "phpstan/phpstan": "^1.10", |  | ||||||
|         "squizlabs/php_codesniffer": "^3.9" |  | ||||||
|     }, |     }, | ||||||
|     "scripts": { |     "scripts": { | ||||||
|         "test":           "vendor/bin/phpunit tests --display-warnings", |         "test":           "vendor/bin/phpunit tests --display-warnings", | ||||||
|   | |||||||
							
								
								
									
										2875
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2875
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -15,7 +15,7 @@ use Nette\Schema\Expect; | |||||||
| /** | /** | ||||||
|  * Mostly working as a register pattern for the logging and configuration. |  * Mostly working as a register pattern for the logging and configuration. | ||||||
|  */ |  */ | ||||||
| class App | final class App | ||||||
| { | { | ||||||
|     /// Logging instance |     /// Logging instance | ||||||
|     protected Logger $logger; |     protected Logger $logger; | ||||||
| @@ -27,7 +27,7 @@ class App | |||||||
|      * |      * | ||||||
|      * @param string $configFile Relative or full path to YML config. |      * @param string $configFile Relative or full path to YML config. | ||||||
|      * |      * | ||||||
|      * @SuppressWarnings(PHPMD.StaticAccess) |      * @SuppressWarnings("PHPMD.StaticAccess") | ||||||
|      */ |      */ | ||||||
|     public function __construct(string $configFile) |     public function __construct(string $configFile) | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -20,8 +20,9 @@ use DateTime; | |||||||
|     name: 'backup', |     name: 'backup', | ||||||
|     description: 'Start backup to assigned buckets', |     description: 'Start backup to assigned buckets', | ||||||
| )] | )] | ||||||
| class CommandBackup extends Command | final class CommandBackup extends Command | ||||||
| { | { | ||||||
|  |     #[\Override] | ||||||
|     protected function configure(): void |     protected function configure(): void | ||||||
|     { |     { | ||||||
|         $this->addArgument( |         $this->addArgument( | ||||||
| @@ -43,6 +44,7 @@ class CommandBackup extends Command | |||||||
|      *    5. Send push notifications. |      *    5. Send push notifications. | ||||||
|      * 3. Report final success |      * 3. Report final success | ||||||
|      */ |      */ | ||||||
|  |     #[\Override] | ||||||
|     protected function execute(InputInterface $input, OutputInterface $output): int |     protected function execute(InputInterface $input, OutputInterface $output): int | ||||||
|     { |     { | ||||||
|         $sio = new SymfonyStyle($input, $output); |         $sio = new SymfonyStyle($input, $output); | ||||||
|   | |||||||
| @@ -15,8 +15,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; | |||||||
|     name: 'show', |     name: 'show', | ||||||
|     description: 'Show all backup entries.', |     description: 'Show all backup entries.', | ||||||
| )] | )] | ||||||
| class CommandShow extends Command | final class CommandShow extends Command | ||||||
| { | { | ||||||
|  |     #[\Override] | ||||||
|     protected function configure(): void |     protected function configure(): void | ||||||
|     { |     { | ||||||
|         $this->addArgument( |         $this->addArgument( | ||||||
| @@ -31,6 +32,7 @@ class CommandShow extends Command | |||||||
|      * 2. For each configured backup print the details |      * 2. For each configured backup print the details | ||||||
|      * 3. Exit |      * 3. Exit | ||||||
|      */ |      */ | ||||||
|  |     #[\Override] | ||||||
|     protected function execute(InputInterface $input, OutputInterface $output): int |     protected function execute(InputInterface $input, OutputInterface $output): int | ||||||
|     { |     { | ||||||
|         $sio = new SymfonyStyle($input, $output); |         $sio = new SymfonyStyle($input, $output); | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ namespace App\Notification; | |||||||
| use App\Notification\Ntfy; | use App\Notification\Ntfy; | ||||||
| use Psr\Log\NullLogger; | use Psr\Log\NullLogger; | ||||||
|  |  | ||||||
| class Notification | final class Notification | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * @var NotificationInterface[] $notifiers |      * @var NotificationInterface[] $notifiers | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ use InvalidArgumentException; | |||||||
| /** | /** | ||||||
|  * Send a notification through a ntfy server |  * Send a notification through a ntfy server | ||||||
|  */ |  */ | ||||||
| class Ntfy implements NotificationInterface | final class Ntfy implements NotificationInterface | ||||||
| { | { | ||||||
|     public const int TOPIC_MAX_LENGTH = 256; |     public const int TOPIC_MAX_LENGTH = 256; | ||||||
|     public const int TITLE_MAX_LENGTH = 256; |     public const int TITLE_MAX_LENGTH = 256; | ||||||
| @@ -26,6 +26,7 @@ class Ntfy implements NotificationInterface | |||||||
|      * |      * | ||||||
|      * @param string[] $config Configuration |      * @param string[] $config Configuration | ||||||
|      */ |      */ | ||||||
|  |     #[\Override] | ||||||
|     public static function factory(array $config): self |     public static function factory(array $config): self | ||||||
|     { |     { | ||||||
|         $instance = new self(new Client(new Server($config['domain']))); |         $instance = new self(new Client(new Server($config['domain']))); | ||||||
| @@ -64,6 +65,7 @@ class Ntfy implements NotificationInterface | |||||||
|     /** |     /** | ||||||
|      * Push a message with Ntfy |      * Push a message with Ntfy | ||||||
|      */ |      */ | ||||||
|  |     #[\Override] | ||||||
|     public function send(string $title, string $message): void |     public function send(string $title, string $message): void | ||||||
|     { |     { | ||||||
|         if (! strlen($title) || strlen($title) > self::TITLE_MAX_LENGTH) { |         if (! strlen($title) || strlen($title) > self::TITLE_MAX_LENGTH) { | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ use Exception; | |||||||
|  * Configuration of the mounts must be done before use. |  * Configuration of the mounts must be done before use. | ||||||
|  * Tested using rclone v1.64.0 |  * Tested using rclone v1.64.0 | ||||||
|  */ |  */ | ||||||
| class Rclone | final class Rclone | ||||||
| { | { | ||||||
|     private const int MAX_RUNTIME = 4 * 3600; //4 hours maximum |     private const int MAX_RUNTIME = 4 * 3600; //4 hours maximum | ||||||
|     protected string $version = ""; |     protected string $version = ""; | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ use Twig\Environment; | |||||||
| use Twig\Loader\ArrayLoader; | use Twig\Loader\ArrayLoader; | ||||||
| use App\Template\TwigExtension; | use App\Template\TwigExtension; | ||||||
|  |  | ||||||
| class Twig extends Environment | final class Twig extends Environment | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * @param string[] $templates Array of templates |      * @param string[] $templates Array of templates | ||||||
|   | |||||||
| @@ -13,13 +13,14 @@ use Twig\TwigFilter; | |||||||
|  * |  * | ||||||
|  * Additional formatters for templates |  * Additional formatters for templates | ||||||
|  */ |  */ | ||||||
| class TwigExtension extends AbstractExtension | final class TwigExtension extends AbstractExtension | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Extend the filters |      * Extend the filters | ||||||
|      * |      * | ||||||
|      * @return TwigFilter[] |      * @return TwigFilter[] | ||||||
|      */ |      */ | ||||||
|  |     #[\Override] | ||||||
|     public function getFilters(): array |     public function getFilters(): array | ||||||
|     { |     { | ||||||
|         return [ |         return [ | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ use App\CommandBackup; | |||||||
| #[CoversClass(CommandBackup::class)] | #[CoversClass(CommandBackup::class)] | ||||||
| final class CommandBackupTest extends \PHPUnit\Framework\TestCase | final class CommandBackupTest extends \PHPUnit\Framework\TestCase | ||||||
| { | { | ||||||
|  |     #[\Override] | ||||||
|     protected function setUp(): void |     protected function setUp(): void | ||||||
|     { |     { | ||||||
|         if (! is_dir('temp')) { |         if (! is_dir('temp')) { | ||||||
| @@ -24,6 +25,7 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase | |||||||
|         exec('rclone test makefiles --files 10 temp/source 2>&1'); |         exec('rclone test makefiles --files 10 temp/source 2>&1'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     #[\Override] | ||||||
|     protected function tearDown(): void |     protected function tearDown(): void | ||||||
|     { |     { | ||||||
|         exec('rclone purge temp 2>&1'); |         exec('rclone purge temp 2>&1'); | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ final class NtfyTest extends TestCase | |||||||
|      */ |      */ | ||||||
|     private MockObject $client; |     private MockObject $client; | ||||||
|  |  | ||||||
|  |     #[\Override] | ||||||
|     protected function setUp(): void |     protected function setUp(): void | ||||||
|     { |     { | ||||||
|         $this->client = $this->createMock(Client::class); |         $this->client = $this->createMock(Client::class); | ||||||
| @@ -29,7 +30,7 @@ final class NtfyTest extends TestCase | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @SuppressWarnings(PHPMD.StaticAccess) |      * @SuppressWarnings("PHPMD.StaticAccess") | ||||||
|      */ |      */ | ||||||
|     public function testFactory(): void |     public function testFactory(): void | ||||||
|     { |     { | ||||||
|   | |||||||
| @@ -10,11 +10,13 @@ use PHPUnit\Framework\TestCase; | |||||||
|  |  | ||||||
| final class RcloneTest extends TestCase | final class RcloneTest extends TestCase | ||||||
| { | { | ||||||
|  |     #[\Override] | ||||||
|     protected function setUp(): void |     protected function setUp(): void | ||||||
|     { |     { | ||||||
|         exec('rclone test makefiles temp/source 2>&1'); |         exec('rclone test makefiles temp/source 2>&1'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     #[\Override] | ||||||
|     protected function tearDown(): void |     protected function tearDown(): void | ||||||
|     { |     { | ||||||
|         exec('rclone purge temp 2>&1'); |         exec('rclone purge temp 2>&1'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user