Skip to content

Commit

Permalink
use right trigger error level for deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Dec 8, 2023
1 parent dfe93b5 commit d8c51ad
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
*/
public function getAsJson(ResponseInterface $response): object
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, use \Sysix\LexOffice\Utils::getJsonFromResponse instead', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, use \Sysix\LexOffice\Utils::getJsonFromResponse instead', E_USER_DEPRECATED);

$body = $response->getBody()->__toString();

Expand Down
4 changes: 2 additions & 2 deletions src/Clients/Traits/VoucherListTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait VoucherListTrait
*/
public function getPage(int $page): ResponseInterface
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED);

$client = new VoucherList($this->api);
$client->setToEverything();
Expand All @@ -26,7 +26,7 @@ public function getPage(int $page): ResponseInterface
*/
public function getAll(): ResponseInterface
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED);

$client = new VoucherList($this->api);
$client->setToEverything();
Expand Down
4 changes: 2 additions & 2 deletions src/Clients/Voucher.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function upload(string $id, string $filepath): ResponseInterface
*/
public function getAll(): ResponseInterface
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED);

$client = new VoucherList($this->api);

Expand All @@ -54,7 +54,7 @@ public function getAll(): ResponseInterface
*/
$client->statuses = ['open', 'paid', 'paidoff', 'voided', 'transferred', 'sepadebit'];
$client->types = ['salesinvoice', 'salescreditnote', 'purchaseinvoice', 'purchasecreditnote'];

return $client->getAll();
}
}
2 changes: 1 addition & 1 deletion src/Clients/VoucherList.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class VoucherList extends PaginationClient
*/
public function setToEverything(): self
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED);

$this->types = [
'salesinvoice',
Expand Down
2 changes: 1 addition & 1 deletion src/PaginationClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getPage(int $page): ResponseInterface
*/
public function getAll(): ResponseInterface
{
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_WARNING);
trigger_error(self::class . '::' . __METHOD__ . ' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED);

$response = $this->getPage(0);
/** @var ?stdClass{totalPages:int, content:stdClass[]} $result */
Expand Down
2 changes: 1 addition & 1 deletion tests/TestClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function expectDeprecationV1Warning(string $method): void
{
set_error_handler(static function (int $errno, string $errstr): void {
throw new DeprecationException($errstr, $errno);
}, E_USER_WARNING);
}, E_USER_DEPRECATED);

$this->expectException(DeprecationException::class);

Expand Down

0 comments on commit d8c51ad

Please sign in to comment.