TableFindByPropertyMethodReflection.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. namespace Cake\PHPStan;
  4. use Cake\ORM\Query\SelectQuery;
  5. use PHPStan\Reflection\ClassReflection;
  6. use PHPStan\Reflection\MethodReflection;
  7. use PHPStan\Type\ObjectType;
  8. use PHPStan\Type\Type;
  9. class TableFindByPropertyMethodReflection implements MethodReflection
  10. {
  11. /**
  12. * @var string
  13. */
  14. private $name;
  15. /**
  16. * @var \PHPStan\Reflection\ClassReflection
  17. */
  18. private $declaringClass;
  19. public function __construct(string $name, ClassReflection $declaringClass)
  20. {
  21. $this->name = $name;
  22. $this->declaringClass = $declaringClass;
  23. }
  24. public function getDeclaringClass(): ClassReflection
  25. {
  26. return $this->declaringClass;
  27. }
  28. public function getPrototype(): MethodReflection
  29. {
  30. return $this;
  31. }
  32. public function isStatic(): bool
  33. {
  34. return false;
  35. }
  36. /**
  37. * @return \PHPStan\Reflection\ParameterReflection[]
  38. */
  39. public function getParameters(): array
  40. {
  41. return [];
  42. }
  43. public function isVariadic(): bool
  44. {
  45. return true;
  46. }
  47. public function isPrivate(): bool
  48. {
  49. return false;
  50. }
  51. public function isPublic(): bool
  52. {
  53. return true;
  54. }
  55. public function getName(): string
  56. {
  57. return $this->name;
  58. }
  59. public function getReturnType(): Type
  60. {
  61. return new ObjectType(SelectQuery::class);
  62. }
  63. }