Skip to content

pre-release/v2.0.2 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions .github/lang/es-ES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ Para manejar excepciones puedes utilizar la biblioteca

---

- [Instalación](#instalación)
- [Requisitos](#requisitos)
- [Cómo empezar](#cómo-empezar)
- [Instalación](#instalación)
- [Clases disponibles](#clases-disponibles)
- [Clase ErrorHandler](#clase-errorhandler)
- [Clase ErrorHandled](#clase-errorhandled)
Expand Down Expand Up @@ -67,79 +66,71 @@ git clone https://github.com/josantonius/php-error-handler.git

### Clase ErrorException

```php
/**
* Esta clase es una extensión de ErrorException.
*
* @see https://www.php.net/manual/en/class.errorexception.php
*/
use Josantonius\ErrorHandler\ErrorException;
```
`Josantonius\ErrorHandler\ErrorException` Extends
[ErrorException](https://www.php.net/manual/en/class.errorexception.php)

Obtener el archivo donde se produjo el error:

```php
$errorHandled->getFile(): string
public function getFile(): string;
```

Obtener el nivel del error:

```php
$errorHandled->getLevel(): int
public function getLevel(): int;
```

Obtener el la línea donde se produjo el error:

```php
$errorHandled->getLine(): int
public function getLine(): int;
```

Obtener el mensaje del error:

```php
$errorHandled->getMessage(): string
public function getMessage(): string;
```

Obtener el nombre del error:

```php
$errorHandled->getName(): string
public function getName(): string;
```

### Clase ErrorHandled

```php
use Josantonius\ErrorHandler\ErrorHandled;
```
`Josantonius\ErrorHandler\ErrorHandled`

Obtener el archivo donde se produjo el error:

```php
$errorHandled->getFile(): string
public function getFile(): string;
```

Obtener el nivel del error:

```php
$errorHandled->getLevel(): int
public function getLevel(): int;
```

Obtener el la línea donde se produjo el error:

```php
$errorHandled->getLine(): int
public function getLine(): int;
```

Obtener el mensaje del error:

```php
$errorHandled->getMessage(): string
public function getMessage(): string;
```

Obtener el nombre del error:

```php
$errorHandled->getName(): string
public function getName(): string;
```

### Clase ErrorHandler
Expand All @@ -156,7 +147,7 @@ Convertir errores en excepciones:
*
* @see https://www.php.net/manual/en/errorfunc.constants.php para ver los niveles disponibles.
*/
$errorHandler->convertToExceptions(int ...$errorLevel): ErrorHandler
public function convertToExceptions(int ...$errorLevel): ErrorHandler;
```

Convertir errores en excepciones excepto algunos:
Expand All @@ -171,7 +162,7 @@ Convertir errores en excepciones excepto algunos:
*
* @see https://www.php.net/manual/en/errorfunc.constants.php para ver los niveles disponibles.
*/
$errorHandler->convertToExceptionsExcept(int ...$errorLevel): ErrorHandler
public function convertToExceptionsExcept(int ...$errorLevel): ErrorHandler;
```

Registrar función para manejar errores:
Expand All @@ -182,7 +173,7 @@ Registrar función para manejar errores:
*
* @see https://www.php.net/manual/en/functions.first_class_callable_syntax.php
*/
$errorHandler->register(callable $callback): ErrorHandler
public function register(callable $callback): ErrorHandler;
```

Utilizar los informes de errores para determinar qué errores se gestionan:
Expand All @@ -195,7 +186,7 @@ Utilizar los informes de errores para determinar qué errores se gestionan:
*
* @see https://www.php.net/manual/en/function.error-reporting.php
*/
$errorHandler->useErrorReportingLevel(): ErrorHandler
public function useErrorReportingLevel(): ErrorHandler;
```

## Excepciones utilizadas
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG

## [v2.0.2](https://github.com/josantonius/php-error/releases/tag/v2.0.2) (2022-XX-XX)

* The notation type in the test function names has been changed from camel to snake case for readability.

* Functions were added to document the methods and avoid confusion.

* Disabled the ´CamelCaseMethodName´ rule in ´phpmd.xml´ to avoid warnings about function names in tests.

* The alignment of the asterisks in the comments has been fixed.


## [v2.0.1](https://github.com/josantonius/php-error/releases/tag/v2.0.1) (2022-08-11)

* Documentation was improved.
Expand Down
54 changes: 19 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To handle exceptions you can use the
- [TODO](#todo)
- [Changelog](#changelog)
- [Contribution](#contribution)
- [Sponsor](#Sponsor)
- [Sponsor](#sponsor)
- [License](#license)

---
Expand Down Expand Up @@ -66,92 +66,76 @@ git clone https://github.com/josantonius/php-error-handler.git

### ErrorException Class

```php
/**
* This class extends from ErrorException.
*
* @see https://www.php.net/manual/en/class.errorexception.php
*/
use Josantonius\ErrorHandler\ErrorException;
```
`Josantonius\ErrorHandler\ErrorException` Extends
[ErrorException](https://www.php.net/manual/en/class.errorexception.php)

Gets error file:

```php
$errorHandler->getFile(): string
public function getFile(): string;
```

Gets error level:

```php
$errorHandler->getLevel(): int
public function getLevel(): int;
```

Gets error file line:

```php
$errorHandler->getLine(): int
public function getLine(): int;
```

Gets error message:

```php
$errorHandler->getMessage(): string
public function getMessage(): string;
```

Gets error name:

```php
$errorHandler->getName(): string
public function getName(): string;
```

### ErrorHandled Class

```php
use Josantonius\ErrorHandler\ErrorHandled;
```
`Josantonius\ErrorHandler\ErrorHandled`

Gets error file:

```php
$errorHandled->getFile(): string
public function getFile(): string;
```

Gets error level:

```php
$errorHandled->getLevel(): int
public function getLevel(): int;
```

Gets error file line:

```php
$errorHandled->getLine(): int
public function getLine(): int;
```

Gets error message:

```php
$errorHandled->getMessage(): string
public function getMessage(): string;
```

Gets error name:

```php
$errorHandled->getName(): string
public function getName(): string;
```

### ErrorHandler Class

```php
use Josantonius\ErrorHandler\ErrorHandler;
```

Create object:

```php
$errorHandler = new ErrorHandler();
```
`Josantonius\ErrorHandler\ErrorHandler`

Convert errors to exceptions:

Expand All @@ -165,7 +149,7 @@ Convert errors to exceptions:
*
* @see https://www.php.net/manual/en/errorfunc.constants.php to view available error levels.
*/
$errorHandler->convertToExceptions(int ...$errorLevel): ErrorHandler
public function convertToExceptions(int ...$errorLevel): ErrorHandler;
```

Convert errors to exceptions except for some of them:
Expand All @@ -180,7 +164,7 @@ Convert errors to exceptions except for some of them:
*
* @see https://www.php.net/manual/en/errorfunc.constants.php to view available error levels.
*/
$errorHandler->convertToExceptionsExcept(int ...$errorLevel): ErrorHandler
public function convertToExceptionsExcept(int ...$errorLevel): ErrorHandler;
```

Register error handler function:
Expand All @@ -191,7 +175,7 @@ Register error handler function:
*
* @see https://www.php.net/manual/en/functions.first_class_callable_syntax.php
*/
$errorHandler->register(callable $callback): ErrorHandler
public function register(callable $callback): ErrorHandler;
```

Use error reporting to determine which errors are handled:
Expand All @@ -204,7 +188,7 @@ Use error reporting to determine which errors are handled:
*
* @see https://www.php.net/manual/en/function.error-reporting.php
*/
$errorHandler->useErrorReportingLevel(): ErrorHandler
public function useErrorReportingLevel(): ErrorHandler;
```

## Exceptions Used
Expand Down
2 changes: 1 addition & 1 deletion phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<rule ref="rulesets/controversial.xml/Superglobals" />
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
<!--<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>-->
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />

Expand Down
14 changes: 7 additions & 7 deletions src/ErrorException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

/*
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Josantonius\ErrorHandler;

Expand Down
14 changes: 7 additions & 7 deletions src/ErrorHandled.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
declare(strict_types=1);

/*
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Josantonius\ErrorHandler;

Expand Down
14 changes: 7 additions & 7 deletions src/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
declare(strict_types=1);

/*
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
* This file is part of https://github.com/josantonius/php-error-handler repository.
*
* (c) Josantonius <hello@josantonius.dev>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Josantonius\ErrorHandler;

Expand Down
Loading