Skip to content

Commit

Permalink
Fix missleading deprecated phpdoc attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Oct 26, 2023
1 parent 7790b3b commit 4b14fe0
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 28 deletions.
10 changes: 4 additions & 6 deletions src/Accessable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ public function get($key);
/**
* Check if a value exists
*
* @deprecated `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change bool `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @param mixed $key The key
*
* @return bool
*/
public function has($key);
// public function has($key): bool;
public function has($key)/*: bool */;

/**
* Returns the keys of all setted values
*
* @deprecated `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change array `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @return array<string|int> Keys of all setted values
*/
public function getKeys();
// public function getKeys(): array;
public function getKeys()/*: array */;
}
2 changes: 1 addition & 1 deletion src/Exception/AccessException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

namespace Art4\JsonApiClient\Exception;

class AccessException extends \RuntimeException implements Exception, \Throwable {}
class AccessException extends \RuntimeException implements Exception {}
6 changes: 3 additions & 3 deletions src/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Art4\JsonApiClient\Exception;

/**
* @deprecated `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0. Do the same in your implementation now to avoid errors.
* Please note: `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0. Do the same in your implementation now to avoid errors.
*/
// interface Exception extends \Throwable
interface Exception {}
interface Exception /*extends \Throwable */
{}
2 changes: 1 addition & 1 deletion src/Exception/FactoryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

namespace Art4\JsonApiClient\Exception;

class FactoryException extends \Exception implements Exception, \Throwable {}
class FactoryException extends \Exception implements Exception {}
2 changes: 1 addition & 1 deletion src/Exception/InputException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

namespace Art4\JsonApiClient\Exception;

class InputException extends \Exception implements Exception, \Throwable {}
class InputException extends \Exception implements Exception {}
2 changes: 1 addition & 1 deletion src/Exception/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

namespace Art4\JsonApiClient\Exception;

class ValidationException extends \InvalidArgumentException implements Exception, \Throwable {}
class ValidationException extends \InvalidArgumentException implements Exception {}
5 changes: 2 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ interface Factory
/**
* Create a new instance of a class
*
* @deprecated `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change Accessable `\Art4\JsonApiClient\Factory::make()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @param array<mixed|Manager|Accessable> $args
*
* @return \Art4\JsonApiClient\Accessable
*/
public function make(string $name, array $args = []);
// public function make(string $name, array $args = []): Accessable;
public function make(string $name, array $args = [])/*: Accessable */;
}
5 changes: 2 additions & 3 deletions src/Input/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Input
/**
* Get the input as simple object
*
* @deprecated `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change \stdClass `\Art4\JsonApiClient\Input\Input::getAsObject()` will add `\stdClass` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* This should be a native PHP stdClass object, so Manager could
* iterate over all public attributes
Expand All @@ -25,6 +25,5 @@ interface Input
*
* @return \stdClass
*/
public function getAsObject();
// public function getAsObject(): \stdClass;
public function getAsObject()/*: \stdClass */;
}
11 changes: 4 additions & 7 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ interface Manager
/**
* Parse the input
*
* @deprecated `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change Accessable `\Art4\JsonApiClient\Manager::parse()` will add `\Art4\JsonApiClient\Accessable` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @throws \Art4\JsonApiClient\Exception\InputException If $input contains invalid JSON API
* @throws \Art4\JsonApiClient\Exception\ValidationException If $input contains invalid JSON API
*
* @return \Art4\JsonApiClient\Accessable
*/
public function parse(Input $input);
// public function parse(Input $input): Accessable;
public function parse(Input $input)/*: Accessable */;

/**
* Get a factory from the manager
*
* @deprecated `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change Factory `\Art4\JsonApiClient\Manager::getFactory()` will add `\Art4\JsonApiClient\Factory` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @return \Art4\JsonApiClient\Factory
*/
public function getFactory();
// public function getFactory(): Factory;
public function getFactory()/*: Factory */;

/**
* Get a param by key
Expand All @@ -46,5 +44,4 @@ public function getFactory();
* @return mixed
*/
public function getParam(string $key, $default);
// public function getParam(string $key, $default);
}
4 changes: 2 additions & 2 deletions src/Serializer/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ interface Serializer
/**
* Serialize data
*
* @deprecated `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
* @return-type-will-change ?array `\Art4\JsonApiClient\Serializer\Serializer::serialize()` will add `?array` as a native return type declaration in v2.0. Do the same in your implementation now to avoid errors.
*
* @return array<string, mixed>|null
*/
public function serialize(Accessable $data);
public function serialize(Accessable $data)/*: ?array */;
}

0 comments on commit 4b14fe0

Please sign in to comment.