Skip to content

Commit cec8a31

Browse files
committed
docs: add functions to document methods
Functions were added to document the methods and avoid confusion. Closes #1
1 parent a47800c commit cec8a31

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

.github/lang/es-ES/README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,39 +61,34 @@ git clone https://github.com/josantonius/php-exception-handler.git
6161

6262
### Clase ExceptionHandler
6363

64-
```php
65-
use Josantonius\ExceptionHandler\ExceptionHandler;
66-
```
64+
`Josantonius\ExceptionHandler\ExceptionHandler`
6765

6866
Establece un manejador de excepciones:
6967

7068
```php
7169
/**
7270
* Sets a exception handler.
7371
*
74-
* @param callable $callback Función para manejo de excepciones.
75-
* @param array $runBeforeCallback Métodos a llamar en la excepción antes del callback.
76-
* @param array $runAfterCallback Métodos a llamar en la excepción después del callback.
72+
* @param callable $callback Exception handler function.
73+
* @param string[] $runBeforeCallback Method names to call in the exception before run callback.
74+
* @param string[] $runAfterCallback Method names to call in the exception after run callback.
7775
*
78-
* @throws NotCallableException si la llamada de retorno no es de tipo callable.
79-
* @throws WrongMethodNameException si el nombre del método no es string o está vacío.
76+
* @throws NotCallableException if the callback is not callable.
77+
* @throws WrongMethodNameException if the method names are not string or are empty.
8078
*
8179
* @see https://www.php.net/manual/en/functions.first_class_callable_syntax.php
8280
*/
83-
new ExceptionHandler(
84-
callable $callback,
85-
string[] $runBeforeCallback = [],
86-
string[] $runAfterCallback = []
81+
public function __construct(
82+
private callable $callback,
83+
private array $runBeforeCallback = [],
84+
private array $runAfterCallback = []
8785
);
8886
```
8987

9088
## Excepciones utilizadas
9189

9290
```php
9391
use Josantonius\ExceptionHandler\Exceptions\NotCallableException;
94-
```
95-
96-
```php
9792
use Josantonius\ExceptionHandler\Exceptions\WrongMethodNameException;
9893
```
9994

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PHP library for handling exceptions.
2525
- [TODO](#todo)
2626
- [Changelog](#changelog)
2727
- [Contribution](#contribution)
28-
- [Sponsor](#Sponsor)
28+
- [Sponsor](#sponsor)
2929
- [License](#license)
3030

3131
---
@@ -61,9 +61,7 @@ git clone https://github.com/josantonius/php-exception-handler.git
6161

6262
### ExceptionHandler Class
6363

64-
```php
65-
use Josantonius\ExceptionHandler\ExceptionHandler;
66-
```
64+
`Josantonius\ExceptionHandler\ExceptionHandler`
6765

6866
Sets a exception handler:
6967

@@ -72,28 +70,25 @@ Sets a exception handler:
7270
* Sets a exception handler.
7371
*
7472
* @param callable $callback Exception handler function.
75-
* @param array $runBeforeCallback Method names to call in the exception before run callback.
76-
* @param array $runAfterCallback Method names to call in the exception after run callback.
73+
* @param string[] $runBeforeCallback Method names to call in the exception before run callback.
74+
* @param string[] $runAfterCallback Method names to call in the exception after run callback.
7775
*
7876
* @throws NotCallableException if the callback is not callable.
7977
* @throws WrongMethodNameException if the method names are not string or are empty.
8078
*
8179
* @see https://www.php.net/manual/en/functions.first_class_callable_syntax.php
8280
*/
83-
new ExceptionHandler(
84-
callable $callback,
85-
string[] $runBeforeCallback = [],
86-
string[] $runAfterCallback = []
81+
public function __construct(
82+
private callable $callback,
83+
private array $runBeforeCallback = [],
84+
private array $runAfterCallback = []
8785
);
8886
```
8987

9088
## Exceptions Used
9189

9290
```php
9391
use Josantonius\ExceptionHandler\Exceptions\NotCallableException;
94-
```
95-
96-
```php
9792
use Josantonius\ExceptionHandler\Exceptions\WrongMethodNameException;
9893
```
9994

0 commit comments

Comments
 (0)