Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoutePluginManager has incorrect generic statements #56

Open
boesing opened this issue Jan 10, 2024 · 2 comments
Open

RoutePluginManager has incorrect generic statements #56

boesing opened this issue Jan 10, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working

Comments

@boesing
Copy link
Member

boesing commented Jan 10, 2024

Bug Report

Q A
Version(s) 3.6.0 until latest

Summary

The RoutePluginManager is a plugin manager implementations.
Plugin manager implementations have to provide their generic type instead of passing it to someone else.

Current behavior

* @template InstanceType of RouteInterface
* @extends AbstractPluginManager<InstanceType>

How to reproduce

Just consume the route plugin manager via service manager and then use either get or build method.
Psalm is only able to infer mixed|object instead of RouteInterface (which is the instance the plugin manager provides).

protected $instanceOf = RouteInterface::class;

Expected behavior

- * @template InstanceType of RouteInterface
- * @extends AbstractPluginManager<InstanceType>
+ * @extends AbstractPluginManager<PluginInterface> 
 * @psalm-import-type ServiceManagerConfiguration from ServiceManager
 */
class RoutePluginManager extends AbstractPluginManager
@boesing boesing added the Bug Something isn't working label Jan 10, 2024
@Xerkus
Copy link
Member

Xerkus commented Jan 10, 2024

This implies service manager annotations are wrong somehow. Actually it looks like what we seen with template constraints in inputfilter today.

@Xerkus Xerkus self-assigned this Jan 10, 2024
@boesing
Copy link
Member Author

boesing commented Jan 10, 2024

Service manager does not provide generics on class Level. So these cant be wrong. only plugin managers have class-level generics as these are limited to specific class implementations via instanceOf property.

This has been further improved in v4 of servicemanager via "SingleInstancePluginManager" abstraction.

might just be Inputfilter having invalid generics as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants