Skip to content

Conversation

@ChrisLightfootWild
Copy link
Contributor

Alternative implementation to: #1727

@ChrisLightfootWild ChrisLightfootWild requested a review from a team as a code owner November 14, 2025 20:28
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.28%. Comparing base (7a0727f) to head (5b6d269).

Files with missing lines Patch % Lines
src/API/Common/Compatibility/Psr3.php 0.00% 17 Missing ⚠️
src/API/_compat.php 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1775      +/-   ##
============================================
- Coverage     68.49%   68.28%   -0.22%     
- Complexity     2970     2979       +9     
============================================
  Files           448      450       +2     
  Lines          8714     8734      +20     
============================================
- Hits           5969     5964       -5     
- Misses         2745     2770      +25     
Flag Coverage Δ
8.1 67.98% <0.00%> (-0.16%) ⬇️
8.2 68.17% <0.00%> (-0.21%) ⬇️
8.3 68.14% <0.00%> (-0.23%) ⬇️
8.4 68.22% <0.00%> (-0.10%) ⬇️
8.5 68.11% <0.00%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/API/_compat.php 0.00% <0.00%> (ø)
src/API/Common/Compatibility/Psr3.php 0.00% <0.00%> (ø)

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a0727f...5b6d269. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ChrisLightfootWild ChrisLightfootWild force-pushed the compat/psr3 branch 3 times, most recently from 6e4d973 to f66956d Compare November 14, 2025 21:39
@ChrisLightfootWild
Copy link
Contributor Author

I mentioned that I had an alternative PR to #1727 in today's SIG, and it was suggested to tag @brettmc & @Nevay for some thoughts on this.

I'm totally okay with just closing this if it doesn't seem like the right approach though!

Copy link
Contributor

@Nevay Nevay left a comment

Choose a reason for hiding this comment

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

I prefer the other PR:

  • running the SDK with partially loaded composer.phar dependencies still seems fragile (for example Filesystem::readFile() won't be available when loaded via post-update-cmd script)
  • currently we instrument scripts iff they include vendor/autoload.php, this feels inconsistent


if (
// Provide a backwards-compatible Psr3 implementation when running under composer.
class_exists(InstalledVersions::class, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is InstalledVersions always loaded during composer execution or do we have to drop the autoload: false argument?

if (
// Provide a backwards-compatible Psr3 implementation when running under composer.
class_exists(InstalledVersions::class, false)
&& InstalledVersions::satisfies(new VersionParser(), 'composer/composer', '~2.0')
Copy link
Contributor

Choose a reason for hiding this comment

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

Must first check whether we are running as composer command, otherwise VersionParser might not be available / composer/composer might not be InstalledVersions::isInstalled().

Additionally this might break setups with composer/composer ^2 and psr/log ^3 installed as project dependencies.

class_exists(InstalledVersions::class, false)
&& InstalledVersions::satisfies(new VersionParser(), 'composer/composer', '~2.0')
) {
require_once __DIR__ . '/Common/Compatibility/Psr3.php';
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this file always be loaded before the SDK is autoloaded?

Should IMO instead live in the SDK autoload script, using just the API package with composer scripts works fine.

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.

2 participants