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

Type of Laminas\\Hydrator\\HydratorPluginManager::$sharedByDefault must be bool #126

Open
mairo744 opened this issue Nov 13, 2024 · 1 comment
Labels
Bug Something isn't working
Milestone

Comments

@mairo744
Copy link

Bug Report

Q A
Version(s) 4.15.0

Summary

This issue appeared after updating laminas/laminas-servicemanager to v4

Error message:

Type of Laminas\\Hydrator\\HydratorPluginManager::$sharedByDefault must be bool (as in class Laminas\\ServiceManager\\AbstractPluginManager
)","file":"/var/www/vendor/laminas/laminas-hydrator/src/HydratorPluginManager.php

In the new version of Laminas\ServiceManager\AbstractPluginManager, properties have type declarations:

protected bool $sharedByDefault = true;

Laminas\Hydrator\HydratorPluginManager extends Laminas\ServiceManager\AbstractPluginManager, but its properties are only typed through annotations:

/**
     * Whether or not to share by default (v3)
     *
     * @var bool
     */
    protected $sharedByDefault = false;

Composer allows the installation of laminas/laminas-servicemanager version 4 because it is only a development requirement: https://packagist.org/packages/laminas/laminas-hydrator#4.15.0

Current behavior

The issue does not occur with laminas/laminas-servicemanager version 3.

How to reproduce

Update laminas/laminas-servicemanager to version 4, then observe a crash during the initialization of Laminas\Hydrator\HydratorPluginManager in Laminas\Hydrator\HydratorPluginManagerFactory

$pluginManager = new HydratorPluginManager($container, $options ?? []);

Expected behavior

The HydratorPluginManager should be initialized without type conflicts.

@mairo744 mairo744 added the Bug Something isn't working label Nov 13, 2024
@gsteel
Copy link
Member

gsteel commented Nov 13, 2024

This library does not yet support laminas/[email protected] - the bug is that it is an undeclared dependency and it shouldn't really be installable with service manager v4.

Upgrading to SMv4 here will be a BC break and will need to happen in the next major release

See laminas/laminas-servicemanager#216

@gsteel gsteel added this to the 5.0.0 milestone Nov 13, 2024
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