IControllerMethodReflector.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Olivier Paroz <github@oparoz.com>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP\AppFramework\Utility;
  27. /**
  28. * Interface ControllerMethodReflector
  29. *
  30. * Reads and parses annotations from doc comments
  31. *
  32. * @since 8.0.0
  33. * @deprecated 22.0.0 will be obsolete with native attributes in PHP8
  34. * @see https://help.nextcloud.com/t/how-should-we-use-php8-attributes/104278
  35. */
  36. interface IControllerMethodReflector {
  37. /**
  38. * @param object $object an object or classname
  39. * @param string $method the method which we want to inspect
  40. * @return void
  41. * @since 8.0.0
  42. * @deprecated 17.0.0 Reflect should not be called multiple times and only be used internally. This will be removed in Nextcloud 18
  43. */
  44. public function reflect($object, string $method);
  45. /**
  46. * Inspects the PHPDoc parameters for types
  47. *
  48. * @param string $parameter the parameter whose type comments should be
  49. * parsed
  50. * @return string|null type in the type parameters (@param int $something)
  51. * would return int or null if not existing
  52. * @since 8.0.0
  53. * @deprecated 22.0.0 this method is only used internally
  54. */
  55. public function getType(string $parameter);
  56. /**
  57. * @return array the arguments of the method with key => default value
  58. * @since 8.0.0
  59. * @deprecated 22.0.0 this method is only used internally
  60. */
  61. public function getParameters(): array;
  62. /**
  63. * Check if a method contains an annotation
  64. *
  65. * @param string $name the name of the annotation
  66. * @return bool true if the annotation is found
  67. * @since 8.0.0
  68. * @deprecated 22.0.0 will be obsolete with native attributes in PHP8
  69. * @see https://help.nextcloud.com/t/how-should-we-use-php8-attributes/104278
  70. */
  71. public function hasAnnotation(string $name): bool;
  72. }