laminas / laminas-di

Automated dependency injection for PSR-11 containers
https://docs.laminas.dev/laminas-di/
BSD 3-Clause "New" or "Revised" License
36 stars 20 forks source link

RUNTIME DEFINITION: Update docblocks with `class-string` type #50

Closed sjokkateer closed 2 years ago

sjokkateer commented 2 years ago
Q A
Documentation yes
Bugfix no
BC Break no
New Feature no
RFC no
QA no

Description

This PR updates the left over methods and property in the RuntimeDefinition::class by changing it correctly to class-string.

Assuming correct use of the RuntimeDefinition::class, the RuntimeDefinition::getClassDefinition() method would call RuntimeDefinition::loadClass() which in turn would call RuntimeDefinition::ensureClassExists(). This last method will ensure that $this->definition[$class] is set with $class being an existent class and hence a class-string. As a result, this means that RuntimeDefinition::$definition's type would be array<class-string, ClassDefinition> instead of the current type ClassDefinition[].

This also means that RuntimeDefinitioin::ensureClassExists() is now only called with values of type class-string, hence this is updated as well.

Finally, since both RuntimeDefinition::$definition and RuntimeDefinition::$explicitClasses have keys of type class-string, the return type of RuntimeDefinition::getClasses() must also, hence updated in this PR.