Skip to content

Conversation

@SamMousa
Copy link
Collaborator

@SamMousa SamMousa commented Feb 24, 2025

  • Add CS check to CI

@SamMousa
Copy link
Collaborator Author

This PR contains no manual changes; just the results of running these commands:

 PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix [email protected]
 PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix tests [email protected]

@SamMousa
Copy link
Collaborator Author

@TavoNiievez do we have a codeception wide coding standard? Or can I use PER2.0?

@TavoNiievez
Copy link
Member

@SamMousa No, you can go ahead with PER2.0.

@TavoNiievez
Copy link
Member

TavoNiievez commented Feb 24, 2025

Please note that in the ActiveRecord interface (src/Codeception/Lib/Interfaces/ActiveRecord.php)

public function haveRecord(string $model, array $attributes = []);

$attributes is typed as an array, if you are going to release a new major version of the module soon,
please make sure that the interfaces are implemented as strictly as possible.
you currently have:

    public function haveRecord(string $model, $attributes = []): mixed.

in the module class

Also in the Connector class we can now use an enum like the following:

enum CleanMethod: string {
    case RECREATE = 'recreate';
    case FORCE_RECREATE = 'force_recreate';
    case CLEAR = 'clear';
    case MANUAL = 'manual';
}

and we save ourselves from having multiple unrelated individual constants, plus we can type $responseCleanMethod and $requestCleanMethod with it.

@SamMousa
Copy link
Collaborator Author

Also in the Connector class we can now use an enum like the following:

Yeah I'm not doing that just yet, it's a refactor that can happen in a minor release since it doesn't change the public API.

@SamMousa
Copy link
Collaborator Author

@samdark @TavoNiievez I want to merge this.

I realize it is suboptimal, since code style changes are always messy PRs.
This PR significantly improves our CI:

  • Strict code style
  • Strict SA, for tests too
  • Automated releases

@SamMousa SamMousa marked this pull request as ready for review February 25, 2025 14:54
@SamMousa SamMousa merged commit 3f8ffe0 into master Feb 26, 2025
2 checks passed
@SamMousa SamMousa deleted the php-cs-fixer-per2 branch February 26, 2025 13:10
@github-actions
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants