Skip to content
Permalink
Browse files

PHP 7.4 compatibility fixes

  • Loading branch information...
dg committed Aug 6, 2019
1 parent 4411573 commit 4aff517a1c6bb5c36fa09733d4cea089f529de6d
Showing with 5 additions and 4 deletions.
  1. +1 −1 src/Bridges/DITracy/ContainerPanel.php
  2. +3 −2 src/DI/Container.php
  3. +1 −1 src/DI/ContainerLoader.php
@@ -64,7 +64,7 @@ public function getPanel(): string
$types = [];
foreach ($rc->getMethods() as $method) {
if (preg_match('#^createService(.+)#', $method->getName(), $m) && $method->getReturnType()) {
$types[lcfirst(str_replace('__', '.', $m[1]))] = (string) $method->getReturnType();
$types[lcfirst(str_replace('__', '.', $m[1]))] = $method->getReturnType()->getName();
}
}
$types = $this->getContainerProperty('types') + $types;
@@ -73,7 +73,7 @@ public function addService(string $name, $service)
}
$type = $service instanceof \Closure
? (string) (new \ReflectionFunction($service))->getReturnType()
? (($tmp = (new \ReflectionFunction($service))->getReturnType()) ? $tmp->getName() : '')
: get_class($service);
if (!isset($this->methods[self::getMethodName($name)])) {
@@ -135,7 +135,8 @@ public function getServiceType(string $name): string
return $this->types[$name];
} elseif (isset($this->methods[$method])) {
return (string) (new \ReflectionMethod($this, $method))->getReturnType();
$type = (new \ReflectionMethod($this, $method))->getReturnType();
return $type ? $type->getName() : '';
} else {
throw new MissingServiceException("Service '$name' not found.");
@@ -100,7 +100,7 @@ private function isExpired(string $file, string &$updatedMeta = null): bool
{
if ($this->autoRebuild) {
$meta = @unserialize((string) file_get_contents("$file.meta")); // @ - file may not exist
$orig = $meta[2];
$orig = $meta[2] ?? null;
return empty($meta[0])
|| DependencyChecker::isExpired(...$meta)
|| ($orig !== $meta[2] && $updatedMeta = serialize($meta));

0 comments on commit 4aff517

Please sign in to comment.
You can’t perform that action at this time.