Skip to content

Commit

Permalink
fix various return type
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 15, 2024
1 parent f795b7e commit daf9d9f
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions src/ReflectionClassConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,23 @@ public function getValue()
/**
* @inheritDoc
*/
public function isPrivate()
public function isPrivate(): bool
{
return $this->classConstantNode->isPrivate();
}

/**
* @inheritDoc
*/
public function isProtected()
public function isProtected(): bool
{
return $this->classConstantNode->isProtected();
}

/**
* @inheritDoc
*/
public function isPublic()
public function isPublic(): bool
{
return $this->classConstantNode->isPublic();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReflectionFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function invokeArgs(array $args)
* Only internal functions can be disabled using disable_functions directive.
* User-defined functions are unaffected.
*/
public function isDisabled()
public function isDisabled(): bool
{
return false;
}
Expand Down
18 changes: 9 additions & 9 deletions src/ReflectionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,71 +222,71 @@ public function invokeArgs(?object $object, array $args): mixed
/**
* {@inheritDoc}
*/
public function isAbstract()
public function isAbstract(): bool
{
return $this->getDeclaringClass()->isInterface() || $this->getClassMethodNode()->isAbstract();
}

/**
* {@inheritDoc}
*/
public function isConstructor()
public function isConstructor(): bool
{
return $this->getClassMethodNode()->name->toLowerString() === '__construct';
}

/**
* {@inheritDoc}
*/
public function isDestructor()
public function isDestructor(): bool
{
return $this->getClassMethodNode()->name->toLowerString() === '__destruct';
}

/**
* {@inheritDoc}
*/
public function isFinal()
public function isFinal(): bool
{
return $this->getClassMethodNode()->isFinal();
}

/**
* {@inheritDoc}
*/
public function isPrivate()
public function isPrivate(): bool
{
return $this->getClassMethodNode()->isPrivate();
}

/**
* {@inheritDoc}
*/
public function isProtected()
public function isProtected(): bool
{
return $this->getClassMethodNode()->isProtected();
}

/**
* {@inheritDoc}
*/
public function isPublic()
public function isPublic(): bool
{
return $this->getClassMethodNode()->isPublic();
}

/**
* {@inheritDoc}
*/
public function isStatic()
public function isStatic(): bool
{
return $this->getClassMethodNode()->isStatic();
}

/**
* {@inheritDoc}
*/
public function setAccessible($accessible)
public function setAccessible($accessible): void
{
$this->initializeInternalReflection();

Expand Down
8 changes: 4 additions & 4 deletions src/ReflectionNamedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,31 @@ public function __construct($type, $allowsNull, $isBuiltin)
/**
* @inheritDoc
*/
public function allowsNull()
public function allowsNull(): bool
{
return $this->allowsNull;
}

/**
* @inheritDoc
*/
public function isBuiltin()
public function isBuiltin(): bool
{
return $this->isBuiltin;
}

/**
* @inheritDoc
*/
public function __toString()
public function __toString(): string
{
return $this->type;
}

/**
* @inheritDoc
*/
public function getName()
public function getName(): string
{
return $this->type;
}
Expand Down
16 changes: 8 additions & 8 deletions src/ReflectionParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function getDefaultValueConstantName()
/**
* @inheritDoc
*/
public function getName()
public function getName(): string
{
return (string)$this->parameterNode->var->name;
}
Expand Down Expand Up @@ -312,7 +312,7 @@ public function hasType()
/**
* @inheritDoc
*/
public function isArray()
public function isArray(): bool
{
$type = $this->parameterNode->type;

Expand All @@ -322,7 +322,7 @@ public function isArray()
/**
* @inheritDoc
*/
public function isCallable()
public function isCallable(): bool
{
$type = $this->parameterNode->type;

Expand All @@ -332,39 +332,39 @@ public function isCallable()
/**
* @inheritDoc
*/
public function isDefaultValueAvailable()
public function isDefaultValueAvailable(): bool
{
return isset($this->parameterNode->default);
}

/**
* {@inheritDoc}
*/
public function isDefaultValueConstant()
public function isDefaultValueConstant(): bool
{
return $this->isDefaultValueConstant;
}

/**
* {@inheritDoc}
*/
public function isOptional()
public function isOptional(): bool
{
return $this->isVariadic() || ($this->isDefaultValueAvailable() && $this->haveSiblingsDefaultValues());
}

/**
* @inheritDoc
*/
public function isPassedByReference()
public function isPassedByReference(): bool
{
return (bool) $this->parameterNode->byRef;
}

/**
* @inheritDoc
*/
public function isVariadic()
public function isVariadic(): bool
{
return (bool) $this->parameterNode->variadic;
}
Expand Down
16 changes: 8 additions & 8 deletions src/ReflectionProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function getModifiers(): int
/**
* @inheritDoc
*/
public function getName()
public function getName(): string
{
return $this->propertyNode->name->toString();
}
Expand Down Expand Up @@ -202,7 +202,7 @@ public function getValue($object = null)
/**
* @inheritDoc
*/
public function isDefault()
public function isDefault(): bool
{
// TRUE if the property was declared at compile-time

Expand All @@ -212,39 +212,39 @@ public function isDefault()
/**
* {@inheritDoc}
*/
public function isPrivate()
public function isPrivate(): bool
{
return $this->propertyTypeNode->isPrivate();
}

/**
* {@inheritDoc}
*/
public function isProtected()
public function isProtected(): bool
{
return $this->propertyTypeNode->isProtected();
}

/**
* {@inheritDoc}
*/
public function isPublic()
public function isPublic(): bool
{
return $this->propertyTypeNode->isPublic();
}

/**
* {@inheritDoc}
*/
public function isStatic()
public function isStatic(): bool
{
return $this->propertyTypeNode->isStatic();
}

/**
* {@inheritDoc}
*/
public function setAccessible($accessible)
public function setAccessible($accessible): void
{
$this->initializeInternalReflection();

Expand All @@ -254,7 +254,7 @@ public function setAccessible($accessible)
/**
* @inheritDoc
*/
public function setValue($object, $value = null)
public function setValue($object, $value = null): void
{
$this->initializeInternalReflection();

Expand Down
2 changes: 1 addition & 1 deletion src/ReflectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function allowsNull()
/**
* @inheritDoc
*/
public function isBuiltin()
public function isBuiltin(): bool
{
return $this->isBuiltin;
}
Expand Down
14 changes: 7 additions & 7 deletions src/Traits/ReflectionClassLikeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public function getModifiers(): int
/**
* {@inheritDoc}
*/
public function getName()
public function getName(): string
{
$namespaceName = $this->namespaceName ? $this->namespaceName . '\\' : '';

Expand All @@ -445,7 +445,7 @@ public function getName()
/**
* {@inheritDoc}
*/
public function getNamespaceName()
public function getNamespaceName(): string
{
return $this->namespaceName;
}
Expand Down Expand Up @@ -705,15 +705,15 @@ public function implementsInterface($interfaceName)
/**
* {@inheritDoc}
*/
public function inNamespace()
public function inNamespace(): bool
{
return !empty($this->namespaceName);
}

/**
* {@inheritDoc}
*/
public function isAbstract()
public function isAbstract(): bool
{
if ($this->classLikeNode instanceof Class_ && $this->classLikeNode->isAbstract()) {
return true;
Expand All @@ -729,15 +729,15 @@ public function isAbstract()
/**
* Currently, anonymous classes aren't supported for parsed reflection
*/
public function isAnonymous()
public function isAnonymous(): bool
{
return false;
}

/**
* {@inheritDoc}
*/
public function isCloneable()
public function isCloneable(): bool
{
if ($this->isInterface() || $this->isTrait() || $this->isAbstract()) {
return false;
Expand All @@ -755,7 +755,7 @@ public function isCloneable()
/**
* {@inheritDoc}
*/
public function isFinal()
public function isFinal(): bool
{
$isFinal = $this->classLikeNode instanceof Class_ && $this->classLikeNode->isFinal();

Expand Down

0 comments on commit daf9d9f

Please sign in to comment.