assets icon indicating copy to clipboard operation
assets copied to clipboard

Notify client about incorrect AssetManager::asset usage

Open shvlv opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. I used the AssetManager::asset method to update assets loaded by EncoreEntrypointsLoader but stumbled on the following behavior. When the client doesn't provide second param and assets storage includes several assets shared the same handle (style and script in my case) method silently returns null.

Describe the solution you'd like Throws LogicException from https://github.com/inpsyde/assets/blob/master/src/AssetManager.php#L171 point with a clear description of what will be wrong. Something like: We found 2 assets with the same handle: %s. Are you forgot to provide $type argument?

Describe alternatives you've considered Improve documentation.

shvlv avatar Aug 12 '21 06:08 shvlv