container
container copied to clipboard
Handle preceeding slash in class name handling
Resolves https://github.com/thephpleague/container/issues/237
To summarise that issue:
- PHP class names may be valid in both the format
Foo\Barand also as\Foo\Barwhen used as a string - Using
Foo::classreturnsFoo\Barbut legitimate user code may handle as\Foo\Barand this would work forclass_existsornew $varcases - Because of this, a concrete class may be set with one form of slash, and got with the other. This means the set definition is not used.
- This fix adds test for both ways round that this issue could occur, and implements the class name normalizing in each appropriate place
This aims to be backwards compatible and causes no test failures.