laminas / laminas-router

Flexible routing system for HTTP and console applications
https://docs.laminas.dev/laminas-router/
BSD 3-Clause "New" or "Revised" License
34 stars 15 forks source link

Laminas\I18n\Translator is a soft dependency #55

Open nusphere opened 9 months ago

nusphere commented 9 months ago

Bug Report

When doing an class_implements for Laminas\Router\Http\TranslatorAwareTreeRouteStack

Error: Interface "Laminas\I18n\Translator\TranslatorAwareInterface" not found

Q A
Version(s) 3.12.0

Summary

Current behavior

How to reproduce

require this package try class_implements for Laminas\Router\Http\TranslatorAwareTreeRouteStack (interface doesnt matter) error occues

Expected behavior

Interface should exists by adding a depencency to this package

Xerkus commented 9 months ago

This is an optional dependency. It won't be added as direct requirement.

You got same answer in https://github.com/laminas/laminas-validator/issues/220

We no longer allow optional dependencies to be added, however they would remain optional until they removed by a next major release.

nusphere commented 9 months ago

This error still exists.

That doesn't mean that this bug needs to be fixed immediately. But in fact it is an error that is documented here.

Ocramius commented 9 months ago

Disagree: while optional dependencies are indeed problematic, they are not bugs per-se, and rather require manual intervention.

Analyzing vendor/ code out of context is still a mistake, since you may even get random test assets in there, so be careful about your assumptions: this is NOT a bug.

They are a concept of the past: we got rid of them from new code, but there's no easy way around this.

The usage of such code with optional dependencies requires additional steps that are not "out of the box", and that is OK-ish, especially when compared with introducing BC breaks.

Xerkus commented 9 months ago

I will reopen it as an improvement to track for next major.