Skip to content

Conversation

@jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Dec 31, 2024

GitHubDriver::getFundingInfo(): order the cases

This re-orders the cases in the switch to follow the same order as the GitHub documentation (largely alphabetic) for easier comparisons between the two lists.

Refs:

GitHubDriver::getFundingInfo(): add support for thanks.dev and polar.sh

GitHub looks to have added a dedicated syntax for the thanks.dev funding platform when added to a funding.yml file.
However, it looks like Composer does not (yet) support this syntax as can be seen from failed Packagist updates of the dev branches of the PHP_CodeSniffer and PHPCompatibility packages.

image

The polar.sh funding platform also appears to be newly supported by GH and missing from the list.

This PR fixes both.

Refs:


Note: while I'd love to add some tests for this, it looks like there are no tests covering this functionality at all yet and it would require some hacks to mock the various API calls to reach the code, while this is a relatively straight forward code change.

As it looks like (open) PR #12247 already adds a test method for this code, I'd like to suggest either of the following:

Let me know what you'd prefer.

Also feel free to let me know if this should be pulled to an older branch. Happy to rebase.

This re-orders the cases in the `switch` to follow the same order as the GitHub documentation (largely alphabetic) for easier comparisons between the two lists. Refs: * https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
GitHub looks to have added a dedicated syntax for the thanks.dev funding platform when added to a `funding.yml` file. However, it looks like Composer does not (yet) support this syntax as can be seen from failed Packagist updates of the dev branches of the [PHP_CodeSniffer](https://packagist.org/packages/squizlabs/php_codesniffer#dev-master) and [PHPCompatibility](https://packagist.org/packages/phpcompatibility/php-compatibility) packages. The polar.sh funding platform also appears to be newly supported by GH and missing from the list. This PR fixes both. Refs: * https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
jrfnl added a commit to PHPCSStandards/.github that referenced this pull request Jan 6, 2025
This reverts commit 1e8e02d. Composer currently does not support the `thanks.dev` funding key, which is causing problems. I've opened a [PR for Composer to fix this](composer/composer#12257), but in the mean time, installing the `dev-master` branch from PHPCS should not be blocked for dependents.
jrfnl added a commit to PHPCompatibility/.github that referenced this pull request Jan 6, 2025
This reverts commit 704eb6c. Composer currently does not support the `thanks.dev` funding key, which is causing problems. I've opened a [PR for Composer to fix this](composer/composer#12257), but in the mean time, installing the `dev-master` branch from PHPCompatibility should not be blocked for dependents.
@jrfnl
Copy link
Contributor Author

jrfnl commented Jan 6, 2025

Hmm... turns out this issue is causing bigger problems than I expected, as dependents using the dev-master branch of projects using thanks_dev in their funding.yml can no longer update and get shown a "Error: Your requirements could not be resolved to an installable set of packages." message.

This message is very confusing for end-users as it doesn't point out the real problem (an issue on Packagist with updating the dev-master branch of the dependency).

The message is also problematic as the issue is not resolvable by end-users, but they have no way of knowing that and may have spend hours already trying to debug this type of installation problem.

I think it would be a good idea to rethink the messaging to the end-user for this situation too....

Case in point: sirbrillig/phpcs-variable-analysis#348

@Seldaek
Copy link
Member

Seldaek commented Jan 10, 2025

I think the confusing errors will be resolved by #12247 - thanks for the fixes here!

@Seldaek Seldaek merged commit 2645d08 into composer:main Jan 10, 2025
19 of 20 checks passed
@Seldaek Seldaek added this to the 2.8 milestone Jan 10, 2025
@jrfnl jrfnl deleted the feature/vcs-github-funding-support-thanksdev branch January 10, 2025 15:41
@Seldaek
Copy link
Member

Seldaek commented Jan 10, 2025

As it looks like (open) PR #12247 already adds a test method for this code, I'd like to suggest either of the following:

Sorry just reading this now 🤦🏻‍♂️ anyway these cases are super simple so I'm ok without much testing but the other PR is now merged so if you wanna add more cases feel free to PR 🙏🏻

@jrfnl
Copy link
Contributor Author

jrfnl commented Jan 10, 2025

@Seldaek Happy to help. I do have question though - as this is mostly a problem on the Packagist side of things: should I wait for a new release of Composer before re-applying the change in the funding.yml file(s) or can I safely do this already now this has been merged ?
I hope the latter, as otherwise it would still be problematic for users using older Composer versions, which would mean updating the funding.yml file would still be blocked for quite a while, so thought I'd better check.

@Seldaek
Copy link
Member

Seldaek commented Jan 10, 2025

Nope, I just deployed to packagist with the latest composer commit so it should work now.

jrfnl added a commit to jrfnl/composer that referenced this pull request Jan 10, 2025
Glad that I added some tests as this meant I found a bug in the PR I pulled previously (composer#12257). The `thanks_dev` key expects a username in the format `u/gh/USERNAME`, but the call to `basename()` was stripping the `u/gh/` part off. If the use of `basename()` is preferred here, the alternative would be to add `u/gh/` to the default URL prefix for thanks.dev. Let me know if you me to change that.
@jrfnl
Copy link
Contributor Author

jrfnl commented Jan 10, 2025

@Seldaek Thanks for confirming! I've opened PR #12271 now to add some tests (and found a bug in this PR via the tests 😀).

jrfnl added a commit to jrfnl/composer that referenced this pull request Jan 10, 2025
Glad that I added some tests as this meant I found a bug in the PR I pulled previously (composer#12257). The `thanks_dev` key expects a username in the format `u/gh/USERNAME`, but the call to `basename()` was stripping the `u/gh/` part off. If the use of `basename()` is preferred here, the alternative would be to add `u/gh/` to the default URL prefix for thanks.dev. Let me know if you me to change that.
jrfnl added a commit to PHPCSStandards/.github that referenced this pull request Jan 20, 2025
This commit was previously added and reverted as Composer didn't support recognition of this funding channel yet. That has now been fixed via composer/composer#12257 and composer/composer#12271, so we should be okay for reinstating this.
jrfnl added a commit to PHPCompatibility/.github that referenced this pull request Jan 20, 2025
This commit was previously added and reverted as Composer didn't support recognition of this funding channel yet. That has now been fixed via composer/composer#12257 and composer/composer#12271, so we should be okay for reinstating this.
kayw-geek pushed a commit to kayw-geek/composer that referenced this pull request Aug 14, 2025
Glad that I added some tests as this meant I found a bug in the PR I pulled previously (composer#12257). The `thanks_dev` key expects a username in the format `u/gh/USERNAME`, but the call to `basename()` was stripping the `u/gh/` part off. If the use of `basename()` is preferred here, the alternative would be to add `u/gh/` to the default URL prefix for thanks.dev. Let me know if you me to change that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants