Skip to content

Commit

Permalink
refactor: PHPStan code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Apr 15, 2024
1 parent 1bd7bbb commit 631ce3c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/base/ObjectParserAutocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use nystudio107\codeeditor\models\CompleteItem;
use nystudio107\codeeditor\types\CompleteItemKind;
use phpDocumentor\Reflection\DocBlockFactory;
use phpDocumentor\Reflection\DocBlockFactoryInterface;
use ReflectionClass;
use ReflectionException;
use ReflectionMethod;
Expand Down Expand Up @@ -140,11 +141,11 @@ public function parseObject(string $name, $object, int $recursionDepth, string $

/**
* @param $object
* @param DocBlockFactory $factory
* @param DocBlockFactoryInterface $factory
* @param string $name
* @param $path
*/
protected function getClassCompletion($object, DocBlockFactory $factory, string $name, $path): void
protected function getClassCompletion($object, DocBlockFactoryInterface $factory, string $name, $path): void
{
try {
$reflectionClass = new ReflectionClass($object);
Expand Down Expand Up @@ -187,11 +188,11 @@ protected function getComponentCompletion($object, $recursionDepth, $path): void

/**
* @param $object
* @param DocBlockFactory $factory
* @param DocBlockFactoryInterface $factory
* @param $recursionDepth
* @param string $path
*/
protected function getPropertyCompletion($object, DocBlockFactory $factory, $recursionDepth, string $path): void
protected function getPropertyCompletion($object, DocBlockFactoryInterface $factory, $recursionDepth, string $path): void
{
try {
$reflectionClass = new ReflectionClass($object);
Expand Down Expand Up @@ -252,7 +253,7 @@ protected function getPropertyCompletion($object, DocBlockFactory $factory, $rec
if ((PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 4) || (PHP_MAJOR_VERSION >= 8)) {
if ($reflectionProperty->hasType()) {
$reflectionType = $reflectionProperty->getType();
if ($reflectionType instanceof \ReflectionNamedType) {
if ($reflectionType instanceof ReflectionNamedType) {
$type = $reflectionType->getName();
$detail = $type;
}
Expand Down Expand Up @@ -290,10 +291,10 @@ protected function getPropertyCompletion($object, DocBlockFactory $factory, $rec

/**
* @param $object
* @param DocBlockFactory $factory
* @param DocBlockFactoryInterface $factory
* @param string $path
*/
protected function getMethodCompletion($object, DocBlockFactory $factory, string $path): void
protected function getMethodCompletion($object, DocBlockFactoryInterface $factory, string $path): void
{
try {
$reflectionClass = new ReflectionClass($object);
Expand Down Expand Up @@ -368,11 +369,11 @@ protected function getMethodCompletion($object, DocBlockFactory $factory, string

/**
* @param $object
* @param DocBlockFactory $factory
* @param DocBlockFactoryInterface $factory
* @param $recursionDepth
* @param string $path
*/
protected function getBehaviorCompletion($object, DocBlockFactory $factory, $recursionDepth, string $path): void
protected function getBehaviorCompletion($object, DocBlockFactoryInterface $factory, $recursionDepth, string $path): void
{
if ($object instanceof Element) {
$behaviorClass = $object->getBehavior('customFields');
Expand All @@ -386,10 +387,10 @@ protected function getBehaviorCompletion($object, DocBlockFactory $factory, $rec
* Try to get the best documentation block we can
*
* @param ReflectionClass|ReflectionMethod $reflection
* @param DocBlockFactory $factory
* @param DocBlockFactoryInterface $factory
* @return string
*/
protected function getDocs($reflection, DocBlockFactory $factory): string
protected function getDocs($reflection, DocBlockFactoryInterface $factory): string
{
$docs = $reflection->getDocComment();
if ($docs) {
Expand Down

0 comments on commit 631ce3c

Please sign in to comment.