Skip to content

Commit

Permalink
Renamed ParameterMissingException to MissingParameterException
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrx committed Sep 30, 2022
1 parent 593e4c0 commit 1177a22
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
5 changes: 5 additions & 0 deletions src/Exceptions/MissingParameterException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
namespace Ioc\Exceptions;

class MissingParameterException extends \RuntimeException {
}
5 changes: 0 additions & 5 deletions src/Exceptions/ParameterMissingException.php

This file was deleted.

11 changes: 3 additions & 8 deletions src/MethodInvoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Ioc;

use Ioc\Exceptions\DefinitionNotFoundException;
use Ioc\Exceptions\Exceptions\ParameterMissingException;
use Ioc\Exceptions\MissingParameterException;

interface MethodInvoker {
/**
Expand All @@ -11,27 +11,22 @@ interface MethodInvoker {
* method or a class not yet instantiated. The implementation determines how to handle the callable and find the
* appropriate method for invocation. If no matching class could be found, it must throw an
* Ioc\Exceptions\DefinitionNotFoundException.
*
* Following forms must be accepted:
*
* $methodInvoker->invoke(function () {}, $arguments);
* A closure
*
* $methodInvoker->invoke(array($instance, 'methodName'), $arguments);
* A classic callable with an already instantiated $instance and a methodName.
*
* $methodInvoker->invoke(array('Full\\Qualified\\Class\\Name', 'methodName'), $arguments);
* This is not(!) a static call. Full\Qualified\Class\Name gats instantiated first before calling methodName.
*
* The called method could have either scalar parameters (with or without default values) or Typehinted patemeters
* mixed together. Scalar-types and array-types can not be determined automatically. They must be provided through
* $arguments.
*
* @param callable $callable
* @param array $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
* @throws DefinitionNotFoundException
* @throws ParameterMissingException
* @return mixed
*@throws MissingParameterException
* @throws DefinitionNotFoundException
*/
public function invoke($callable, array $arguments = array());
}
6 changes: 3 additions & 3 deletions src/ObjectFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Ioc;

use Ioc\Exceptions\DefinitionNotFoundException;
use Ioc\Exceptions\Exceptions\ParameterMissingException;
use Ioc\Exceptions\MissingParameterException;

interface ObjectFactory {
/**
Expand All @@ -12,9 +12,9 @@ interface ObjectFactory {
*
* @param string $className Must be an fully qualified class-name.
* @param array $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
* @throws DefinitionNotFoundException
* @throws ParameterMissingException
* @return mixed
*@throws MissingParameterException
* @throws DefinitionNotFoundException
*/
public function create($className, array $arguments = array());
}

0 comments on commit 1177a22

Please sign in to comment.