« Previous | Next » 

Revision 85dea6c8

ID85dea6c8e1ef23d2cdc6e4ecbc4f1b35d4bb55b1

Added by Bastian Waidelich over 7 years ago

[BUGFIX] Fix basic support for packages with multiple PSR-0/4 mappings

Some (3rd party) package define multiple autoload mappings for
different PHP namespaces in their composer manifest, for example::

"autoload": {
"psr-0": {
"SomeNamespace": "lib/",
"SomeNamespace\\Test": "test/lib/"
}
}

Flow does not yet support multiple autoload mappings but it always
just ignored everything but the first mapping.
With I20777f78f63f512a104c4e144aa29cbedafe0f23 this is no longer the
case and an exception is thrown for packages with more than one
mapping per autoloader type.

This change reintroduces the previous behavior and fixes some minor
bugs along the way.

Background:
Because ``Package::getComposerManifest()`` returns a ``stdClass`` the
code ``count($namespaces) === 1`` always evaluated TRUE.
By casting the manifest to an array (for better HVVM support) this is
no longer the case and the exception is thrown.

In the long run we should replace the stdClass by an associative array
or DTO and introduce real support for multiple autoload mappings.

This change also fixes some minor issues and adds some unit tests.

Change-Id: Ic737cfd2e48c9547c865772d1a6cdd4153ea63bb
Related: #57992
Releases: master

  • added
  • modified
  • copied
  • renamed
  • deleted