Skip to content

fix(composer): Fix psr-4 invalid namespace#35

Merged
pkotets merged 1 commit intoreaddle:masterfrom
vincentmary:fix/non-empty-psr4-prefix-error
Mar 16, 2026
Merged

fix(composer): Fix psr-4 invalid namespace#35
pkotets merged 1 commit intoreaddle:masterfrom
vincentmary:fix/non-empty-psr4-prefix-error

Conversation

@vincentmary
Copy link
Contributor

@vincentmary vincentmary commented Mar 15, 2026

Fix PSR-4 test namespace missing trailing backslash in composer.json

Problem

The autoload-dev section of composer.json declared the test namespace without the required trailing namespace separator:

  "autoload-dev": {                                                                                                                                                                                                
      "psr-4": {                                                                                                                                                                                                   
          "Readdle\\AppStoreServerAPI\\Tests": "tests/"                                                                                                                                                            
      }                                                                                                                                                                                                            
  }

According to the PSR-4 specification and Composer's implementation, all namespace prefixes must end with a backslash (). Without it, Composer throws a fatal error when generating the autoloader:

  In ClassLoader.php line 305:
  A non-empty PSR-4 prefix must end with a namespace separator.

This made it impossible to run composer install (or composer dump-autoload) successfully, completely breaking the test suite bootstrap.

Fix

Added the missing trailing backslash to the namespace prefix:

  "autoload-dev": {
      "psr-4": {
          "Readdle\\AppStoreServerAPI\\Tests\\": "tests/"
      }
  }

Impact

Without this fix, vendor/autoload.php was never generated, causing all PHPUnit tests to fail at the bootstrap stage regardless of their content.

# Veuillez saisir le message de validation pour vos modifications. Les lignes
# commençant par '#' seront conservées ; vous pouvez les supprimer vous-même
# si vous le souhaitez. Un message vide abandonne la validation.
#
# Sur la branche fix/non-empty-psr4-prefix-error
# Modifications qui seront validées :
#	modifié :         composer.json
#

# Veuillez saisir le message de validation pour vos modifications. Les lignes
# commençant par '#' seront conservées ; vous pouvez les supprimer vous-même
# si vous le souhaitez. Un message vide abandonne la validation.
#
# Sur la branche fix/non-empty-psr4-prefix-error
# Modifications qui seront validées :
#	modifié :         composer.json
#
@pkotets
Copy link
Collaborator

pkotets commented Mar 16, 2026

Fix PSR-4 test namespace missing trailing backslash in composer.json

Indeed. Thank you for the fix!

@pkotets pkotets merged commit 5074f44 into readdle:master Mar 16, 2026
1 check passed
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