Skip to content

Commit

Permalink
update file
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Mar 28, 2024
1 parent ec5953f commit 344f495
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function getInstance()
return static::$instances;
}

public function bind(string $key, $value)
public function bind(string $key, mixed $value): mixed
{
$this->storage[$key] = $value;
return $value;
Expand Down Expand Up @@ -68,19 +68,19 @@ public function isSingleton(string $key): bool
public function get(string $key): mixed
{
if ($this->has($key)) {
$class = $this->storage[$key] ?? null;

$class = $this->storage[$key];
$instance = is_object($class)
? $class
: $this->storage[$key] = new $class();
: new $class();

$this->storage[$key] = $instance;
return $instance;
}

return false;
}

public function set(string $key, $value): void
public function set(string $key, mixed $value): void
{
$this->storage[$this->key($key)] = $value;
}
Expand Down Expand Up @@ -108,22 +108,22 @@ public function clear(): void
/**
* Array Access
*/
public function offsetExists($offset): bool
public function offsetExists(string $offset): bool
{
return $this->has($offset);
}

public function offsetGet($offset): bool|object
public function offsetGet(string $offset): bool|object
{
return $this->get($offset);
}

public function offsetSet($offset, $value): void
public function offsetSet(string $offset, mixed $value): void
{
$this->set($offset, $value);
}

public function offsetUnset($offset): void
public function offsetUnset(string $offset): void
{
$this->remove($offset);
}
Expand All @@ -143,7 +143,7 @@ public function __get(string $key): mixed
return $this->get($key);
}

public function __set(string $key, $value): void
public function __set(string $key, mixed $value): void
{
$this->set($key, $value);
}
Expand Down

0 comments on commit 344f495

Please sign in to comment.