diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ef897cd..0f7b224 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: check-composer: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -29,12 +29,12 @@ jobs: strategy: matrix: php-version: - - 7.4 - - 8.0 - 8.1 + - 8.2 + - 8.3 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -43,4 +43,9 @@ jobs: coverage: none - name: PHP lint - run: "find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l" + run: "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l" + + - name: OSKAR-PHP-CS-Fixer + uses: OskarStark/php-cs-fixer-ga@3.22.0 + with: + args: --diff --dry-run diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..47cfc29 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,68 @@ +setFinder( + (new PhpCsFixer\Finder()) + ->ignoreVCSIgnored(true) + ->in(__DIR__) + ) + ->setRiskyAllowed(true) + ->setRules([ + '@DoctrineAnnotation' => true, + '@PER' => true, + 'array_syntax' => ['syntax' => 'short'], + 'cast_spaces' => ['space' => 'none'], + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'dir_constant' => true, + 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], + 'function_typehint_space' => true, + 'modernize_strpos' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_superfluous_elseif' => true, + 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_nullsafe_operator' => true, + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], + 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], + 'php_unit_mock_short_will_return' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_scalar' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'return_type_declaration' => ['space_before' => 'none'], + 'single_quote' => true, + 'single_space_around_construct' => true, + 'single_line_comment_style' => ['comment_types' => ['hash']], + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], + ]); diff --git a/Classes/Command/AbstractDoctrineCommand.php b/Classes/Command/AbstractDoctrineCommand.php index e18e0a3..74d2e23 100644 --- a/Classes/Command/AbstractDoctrineCommand.php +++ b/Classes/Command/AbstractDoctrineCommand.php @@ -26,7 +26,6 @@ abstract class AbstractDoctrineCommand extends Command { - protected array $defaultConfiguration = [ 'table_storage' => [ 'table_name' => 'tx_migrations', @@ -87,7 +86,7 @@ protected function runCli(): void $configuration = array_merge( $this->defaultConfiguration, [ - 'migrations_paths' => $extConf['migrationsPaths'] + 'migrations_paths' => $extConf['migrationsPaths'], ], ); diff --git a/Classes/Command/DoctrineDumpCommand.php b/Classes/Command/DoctrineDumpCommand.php index e5cd825..ccb1c78 100644 --- a/Classes/Command/DoctrineDumpCommand.php +++ b/Classes/Command/DoctrineDumpCommand.php @@ -10,7 +10,6 @@ class DoctrineDumpCommand extends AbstractDoctrineCommand { - protected function configure(): void { parent::configure(); @@ -18,7 +17,8 @@ protected function configure(): void $this ->setAliases(['dump-schema']) ->setDescription('Dump the schema for your database to a migration.') - ->setHelp(<<setHelp( + <<%command.name% command dumps the schema for your database to a migration: %command.full_name% @@ -56,7 +56,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineExecuteCommand.php b/Classes/Command/DoctrineExecuteCommand.php index 6509cb1..fe72c38 100644 --- a/Classes/Command/DoctrineExecuteCommand.php +++ b/Classes/Command/DoctrineExecuteCommand.php @@ -54,7 +54,8 @@ protected function configure(): void InputOption::VALUE_NONE, 'Time all the queries individually.' ) - ->setHelp(<<setHelp( + <<%command.name% command executes migration versions up or down manually: %command.full_name% FQCN @@ -88,7 +89,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineGenerateCommand.php b/Classes/Command/DoctrineGenerateCommand.php index 0eeaf9a..4401b64 100644 --- a/Classes/Command/DoctrineGenerateCommand.php +++ b/Classes/Command/DoctrineGenerateCommand.php @@ -21,7 +21,8 @@ protected function configure(): void InputOption::VALUE_REQUIRED, 'The namespace to use for the migration (must be in the list of configured namespaces)' ) - ->setHelp(<<setHelp( + <<%command.name% command generates a blank migration class: %command.full_name% @@ -37,7 +38,7 @@ protected function configure(): void * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException * @throws \Doctrine\DBAL\Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineLatestCommand.php b/Classes/Command/DoctrineLatestCommand.php index ddd98c9..7a751ac 100644 --- a/Classes/Command/DoctrineLatestCommand.php +++ b/Classes/Command/DoctrineLatestCommand.php @@ -23,7 +23,7 @@ protected function configure(): void * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException * @throws \Doctrine\DBAL\Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineListCommand.php b/Classes/Command/DoctrineListCommand.php index bdd042e..2c2b554 100644 --- a/Classes/Command/DoctrineListCommand.php +++ b/Classes/Command/DoctrineListCommand.php @@ -14,7 +14,8 @@ protected function configure(): void $this ->setAliases(['list-migrations']) ->setDescription('Display a list of all available migrations and their status.') - ->setHelp(<<setHelp( + <<%command.name% command outputs a list of all available migrations and their status: %command.full_name% @@ -29,7 +30,7 @@ protected function configure(): void * @throws \TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException * @throws \Doctrine\DBAL\Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineMigrateCommand.php b/Classes/Command/DoctrineMigrateCommand.php index 2f0514e..fc541b3 100644 --- a/Classes/Command/DoctrineMigrateCommand.php +++ b/Classes/Command/DoctrineMigrateCommand.php @@ -10,7 +10,6 @@ class DoctrineMigrateCommand extends AbstractDoctrineCommand { - protected function configure(): void { $this @@ -55,7 +54,8 @@ protected function configure(): void InputOption::VALUE_NONE, 'Time all the queries individually.' ) - ->setHelp(<<setHelp( + <<%command.name% command executes migration versions up or down manually: %command.full_name% FQCN @@ -89,7 +89,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineRollupCommand.php b/Classes/Command/DoctrineRollupCommand.php index 6f020f9..24c5bb8 100644 --- a/Classes/Command/DoctrineRollupCommand.php +++ b/Classes/Command/DoctrineRollupCommand.php @@ -16,7 +16,8 @@ protected function configure(): void $this ->setAliases(['rollup']) ->setDescription('Rollup migrations by deleting all tracked versions and insert the one version that exists.') - ->setHelp(<<setHelp( + <<%command.name% command rolls up migrations by deleting all tracked versions and inserts the one version that exists that was created with the migrations:dump-schema command. @@ -30,7 +31,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineStatusCommand.php b/Classes/Command/DoctrineStatusCommand.php index b3ee0cc..5a90a3b 100644 --- a/Classes/Command/DoctrineStatusCommand.php +++ b/Classes/Command/DoctrineStatusCommand.php @@ -12,7 +12,8 @@ protected function configure(): void $this ->setAliases(['status']) ->setDescription('View the status of a set of migrations.') - ->setHelp(<<setHelp( + <<%command.name% command outputs the status of a set of migrations: %command.full_name% @@ -25,7 +26,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/Classes/Command/DoctrineVersionCommand.php b/Classes/Command/DoctrineVersionCommand.php index 65558c1..6b2c4ba 100644 --- a/Classes/Command/DoctrineVersionCommand.php +++ b/Classes/Command/DoctrineVersionCommand.php @@ -51,7 +51,8 @@ protected function configure(): void InputOption::VALUE_OPTIONAL, 'Apply to specified version.' ) - ->setHelp(<<setHelp( + <<%command.name% command allows you to manually add, delete or synchronize migration versions from the version table: %command.full_name% MIGRATION-FQCN --add @@ -82,7 +83,7 @@ protected function configure(): void /** * @throws \Exception */ - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->runCli(); } diff --git a/composer.json b/composer.json index b908437..d0c8520 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,9 @@ "Migration" ], "require": { - "php": "~7.4.0 || ~8.0.0 || ~8.1.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "doctrine/migrations": "^3.0", - "typo3/cms-core": "^10.4 || ^11" + "typo3/cms-core": "^11.5 || ^12.4" }, "autoload": { "psr-4": {