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

Added Rector and Drupal Check and fixed Drupal 10 compatibility. #250

Merged
merged 17 commits into from
Nov 23, 2022

Conversation

AlexSkrypnyk
Copy link
Contributor

@AlexSkrypnyk AlexSkrypnyk commented Oct 6, 2022

Please note that Rector and Drupal check are only scanning Drupal 8 driver.

Build__767_-_jhedstrom_DrupalDriver_-_Travis_CI

.travis.yml Outdated
@@ -1,8 +1,6 @@
language: php

php:
- 7.4
- 8.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to stop testing on PHP 8.0? It is still supported until October 2023.

I think for as long as we declare in composer.json to be compatible with PHP 7.4 we should also keep testing on 7.4. Probably we shouldn't drop PHP 7.4 support unless we plan to release a new major version.

I suppose the ./vendor/bin/drupal-check test only works on PHP 8.1, but we can still run the remainder of the suite on older PHP versions.

Copy link
Contributor Author

@AlexSkrypnyk AlexSkrypnyk Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drupal 10's requirement is to use 8.1. The CI may fail for 8.0 on D10.

Let me try to get this back and see how CI reacts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP8 did not work

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - drupal/core-recommended[10.0.0-beta1, ..., 10.0.0-beta2] require symfony/process ~v6.1.3 -> satisfiable by symfony/process[v6.1.3].
    - symfony/process[v6.1.0-BETA1, ..., v6.1.3] require php >=8.1 -> your php version (8.0.23) does not satisfy that requirement.
    - Root composer.json requires drupal/core-recommended ^10@beta -> satisfiable by drupal/core-recommended[10.0.0-beta1, 10.0.0-beta2].
The command "composer install" failed and exited with 2 during .

https://app.travis-ci.com/github/jhedstrom/DrupalDriver/jobs/585619255

I've reverted my change so that we are only testing on PHP 8.1

If there is a different way to test with PHP 8.0 - please let me know and I will update this PR.

composer.json Outdated
Comment on lines 35 to 41
"phpcs --standard=./phpcs-ruleset.xml ."

"phpcs --standard=./phpcs-ruleset.xml --ignore=drupal .",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not add the --ignore option inline. Let's instead update the ignored paths in phpcs-ruleset.xml:

<exclude-pattern>./drupal/*</exclude-pattern>

Comment on lines 388 to 395
public function expandEntityBaseFields($entity_type, \stdClass $entity, array $base_fields) {
public function expandEntityBaseFields($entity_type, $entity, array $base_fields) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the \stdClass type hint? This is here to clarify that this is not a real entity but rather a "mocked" value object. It is literally a \stdClass object so the type hint is correct. Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, as well as other changes, is a result of Rector's and drupal-check report. I don't remember what static analysis rule this was violating specifically, but it would not pass those tools.

We can revert and add an ignore comment for those tools to ignore this.

Please advise

src/Drupal/Driver/Cores/Drupal8.php Show resolved Hide resolved
@AlexSkrypnyk
Copy link
Contributor Author

@pfrenssen
Thank you for reviewing this. Agree with all comments. I will address them shortly. Thanks

@AlexSkrypnyk
Copy link
Contributor Author

@pfrenssen
I have addressed all the comments. Could you please review again. Thank you

@jhedstrom
Copy link
Owner

re: testing on previous PHP versions

I think it is these lines that are causing those to not work:

    "drupal/core-composer-scaffold": "^10@beta",
    "drupal/core-recommended": "^10@beta",

They can probably either be removed, or switched to allow the older versions of Drupal as in the require section:

    "drupal/core-utility": "^8.4 || ^9 || ^10.@beta"

@AlexSkrypnyk
Copy link
Contributor Author

@jhedstrom
could you please advise what do they have to be switched to?

@jhedstrom
Copy link
Owner

I think they just need to allow 8.4 and 9 like we do for the core-utility:

    "drupal/core-composer-scaffold": "^8.4 || ^9 || ^10@beta",
    "drupal/core-recommended": "^8.4 || ^9 || ^10@beta",

(we could probably drop 8.x for now too, and then drop 9 when it is eol.)

@AlexSkrypnyk
Copy link
Contributor Author

thank you @jhedstrom
I've updated the configs, but ran out of OSS credits on Travis CI (can we switch to Circle or GH actions?). Not sure how to test this without those credits. Probably have to wait till Nov 1.

@jhedstrom
Copy link
Owner

@AlexSkrypnyk I've opened #254 to track that. It should be a relatively small effort.

Also, there's #249 that might be relevant to the version changes happening here for core libraries.

@AlexSkrypnyk AlexSkrypnyk requested review from claudiu-cristea and removed request for pfrenssen November 23, 2022 06:36
@AlexSkrypnyk
Copy link
Contributor Author

@claudiu-cristea @jhedstrom
I've updated this PR with the latest changes from master and updated CI to include D10. Could you please review. Thank you

@AlexSkrypnyk AlexSkrypnyk requested review from pfrenssen and removed request for claudiu-cristea November 23, 2022 06:49
@jhedstrom jhedstrom merged commit 6057ebd into jhedstrom:master Nov 23, 2022
@jhedstrom
Copy link
Owner

Thanks!

@Kingdutch
Copy link
Contributor

@jhedstrom This PR introduced a conflict with older Drupal versions which seems like something that shouldn't happen in a patch release (but should be a major version release instead). This prevents upgrading in some instances.

See goalgorilla/open_social_dev#51 for the conflict message that this causes.

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

Successfully merging this pull request may close these issues.

5 participants