Skip to content

Commit

Permalink
Add return type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratadox committed Jan 23, 2018
1 parent e7085c1 commit 2e24f43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/ArrayAdapter.php
Expand Up @@ -45,15 +45,15 @@ public function offsetGet($offset)
* @param string $offset
* @param Closure $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value) : void
{
$this->container->set($offset, $value);
}

/**
* @param string $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset) : void
{
$this->container->forget($offset);
}
Expand Down
11 changes: 6 additions & 5 deletions src/Container.php
Expand Up @@ -45,14 +45,15 @@ public function set(
string $theService,
Closure $producingTheService,
bool $cache = true
) {
) : void
{
$this->remember[$theService] = null;
$this->factoryFor[$theService] = $producingTheService;
$this->mustReload[$theService] = !$cache;
}

/** @inheritdoc */
public function forget(string $theService)
public function forget(string $theService) : void
{
unset($this->remember[$theService]);
unset($this->factoryFor[$theService]);
Expand All @@ -76,20 +77,20 @@ private function load(string $theService)
}
}

private function hasNotYetLoaded(string $theService)
private function hasNotYetLoaded(string $theService) : bool
{
return !isset($this->remember[$theService]);
}

/** @throws ServiceNotFound */
private function mustKnowAbout(string $theService)
private function mustKnowAbout(string $theService) : void
{
if ($this->has($theService)) return;
throw ServiceNotFound::noServiceNamed($theService);
}

/** @throws InvalidServiceDefinition */
private function typeMustCheckOut(string $serviceName, $service, string $requiredType)
private function typeMustCheckOut(string $serviceName, $service, string $requiredType) : void
{
if (empty($requiredType)) return;
if (gettype($service) === $requiredType) return;
Expand Down

0 comments on commit 2e24f43

Please sign in to comment.