-
- Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix failing Packagist updates / GitHubDriver::getFundingInfo(): add support for thanks.dev and polar.sh #12257
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
Fix failing Packagist updates / GitHubDriver::getFundingInfo(): add support for thanks.dev and polar.sh #12257
Conversation
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
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.
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.
| Hmm... turns out this issue is causing bigger problems than I expected, as dependents using the This message is very confusing for end-users as it doesn't point out the real problem (an issue on Packagist with updating the 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 |
| I think the confusing errors will be resolved by #12247 - thanks for the fixes here! |
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 🙏🏻 |
| @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 |
| Nope, I just deployed to packagist with the latest composer commit so it should work now. |
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.
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.
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.
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.
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.
GitHubDriver::getFundingInfo(): order the cases
This re-orders the cases in the
switchto 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.ymlfile.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.
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.