PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | src/Container/Container.php +14 -2 2.30.04.16.9 View file →
@@ -196,9 +196,15 @@
196 196 // If the factory is not a Closure, it means it is just a class name which is
197 197 // bound into this container to the abstract type and we will just wrap it
198 198 // up inside its own Closure to give us more convenience when extending.
199 199 if ( ! $concrete instanceof Closure) {
200 - $concrete = $this->getClosure($abstract, $concrete);
200 + if (is_string($concrete) && ($abstract === $concrete || class_exists($concrete) || interface_exists($concrete))) {
201 + $concrete = $this->getClosure($abstract, $concrete);
202 + } else {
203 + $concrete = function () use ($concrete) {
204 + return $concrete;
205 + };
206 + }
201 207 }
202 208
203 209 $this->bindings[$abstract] = compact('concrete', 'shared');
204 210
@@ -996,9 +1002,15 @@
996 1002
997 1003 return $class ? $class->name : null;
998 1004 }
999 1005
1000 - return $parameter->hasType() ? $parameter->getType()->getName() : null;
1006 + $type = $parameter->getType();
1007 +
1008 + if (! $type instanceof \ReflectionNamedType || $type->isBuiltin()) {
1009 + return null;
1010 + }
1011 +
1012 + return $type->getName();
1001 1013 }
1002 1014
1003 1015 /**
1004 1016 * Get the container's bindings.