-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require parameters to have type declarations
- Loading branch information
1 parent
d886e27
commit 97e6c27
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* Thrown when a method parameter lacks a type declaration, essential for DI resolution. | ||
* | ||
* This exception is raised to highlight missing type declarations for parameters in method signatures, | ||
* which are required for the dependency injection system to accurately resolve and inject dependencies. | ||
* Ensures that method parameters within classes conform to type declaration standards necessary for | ||
* effective dependency management. | ||
* | ||
* @package CommonPHP | ||
* @subpackage DependencyInjection\Exceptions | ||
* @author Timothy McClatchey <[email protected]> | ||
* @copyright 2024 CommonPHP.org | ||
* @license http://opensource.org/licenses/MIT MIT License | ||
* @noinspection PhpUnused | ||
*/ | ||
|
||
namespace CommonPHP\DependencyInjection\Exceptions; | ||
|
||
use Throwable; | ||
|
||
class ParameterTypeRequiredException extends DependencyInjectionException | ||
{ | ||
public function __construct(string $class, string $method, string $parameter, ?Throwable $previous = null) | ||
{ | ||
parent::__construct("Parameters must have a type on parameter $parameter for method $method in class $class.", $previous); | ||
$this->code = 1512; | ||
} | ||
} |