Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomOrderedClassElementsFixer error with PHP-CS-Fixer version 3.59.3 #151

Closed
johnbacon opened this issue Jun 20, 2024 · 3 comments
Closed

Comments

@johnbacon
Copy link

johnbacon commented Jun 20, 2024

Running Duster v2.7.5, we're encountering the following error after updating PHP-CS-Fixer from 3.58.1 to 3.59.3:

PHP Fatal error:  Class App\Fixer\ClassNotation\CustomOrderedClassElementsFixer contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PhpCsFixer\Fixer\ConfigurableFixerInterface::getConfigurationDefinition) in /app/laravel/vendor/tightenco/duster/app/Fixer/ClassNotation/CustomOrderedClassElementsFixer.php on line 42

Fatal error: Class App\Fixer\ClassNotation\CustomOrderedClassElementsFixer contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PhpCsFixer\Fixer\ConfigurableFixerInterface::getConfigurationDefinition) in /app/laravel/vendor/tightenco/duster/app/Fixer/ClassNotation/CustomOrderedClassElementsFixer.php on line 42

Based on the file in question I imagine this exists with Duster 3.x as well.

That said, I can't determine what changed in PHP-CS-Fixer between those versions that might have caused this. We're seeing it in both local and GitHub Actions environments.


Note that if you can't replicate this, it may have to do with a customization in our .php-cs-fixer.php:

$config = (new PhpCsFixer\Config())
    ->registerCustomFixers($tightenConfig->getCustomFixers())
	->setRules(array_merge(
		$tightenConfig->getRules(),
		[
			'Tighten/custom_ordered_class_elements' => false, // Disable Tighten's ordering and set our own in stout.json
		]
	))
    ->setFinder($finder)
    ->setRiskyAllowed($tightenConfig->getRiskyAllowed())
	->setUsingCache(true)
	->setCacheFile(__DIR__ . '/storage/cache/.php-cs-fixer.cache');

return $config;
@driftingly
Copy link
Member

Hi @johnbacon Thanks for the report.

I have a PR pending to address this in 2.x - #153

Can you test my fix and confirm it works for you?

composer require "tightenco/duster":"dev-drift/2x-update-custom-order-class" --de
v

@mattstauffer
Copy link
Member

@johnbacon I'm reviewing @driftingly's PR and just want to verify with you; can you check that his fix solved your issue?

@johnbacon
Copy link
Author

@driftingly @mattstauffer Just confirmed it solved the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants