Skip to content

Commit

Permalink
inline mixed type
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 16, 2022
1 parent e302870 commit 76f199b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ private function resolveSkippedRectorClasses(ContainerBuilder $containerBuilder)
return array_filter($skipParameters, fn ($element): bool => $this->isRectorClass($element));
}

/**
* @param mixed $element
*/
private function isRectorClass($element): bool
private function isRectorClass(mixed $element): bool
{
if (! is_string($element)) {
return false;
Expand Down
13 changes: 3 additions & 10 deletions src/PhpParser/Node/NodeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ public function createPropertyAssignmentWithExpr(string $propertyName, Expr $exp
return new Assign($propertyFetch, $expr);
}

/**
* @param mixed $argument
*/
public function createArg($argument): Arg
public function createArg(mixed $argument): Arg
{
return new Arg(BuilderHelpers::normalizeValue($argument));
}
Expand Down Expand Up @@ -511,10 +508,7 @@ public function createClassConstant(string $name, Expr $expr, int $modifier): Cl
return $classConst;
}

/**
* @param mixed $item
*/
private function createArrayItem($item, string | int | null $key = null): ArrayItem
private function createArrayItem(mixed $item, string | int | null $key = null): ArrayItem
{
$arrayItem = null;

Expand Down Expand Up @@ -560,10 +554,9 @@ private function createArrayItem($item, string | int | null $key = null): ArrayI
}

/**
* @param mixed $value
* @return mixed|Error|Variable
*/
private function normalizeArgValue($value)
private function normalizeArgValue(mixed $value)
{
if ($value instanceof Param) {
return $value->var;
Expand Down
20 changes: 2 additions & 18 deletions src/PhpParser/Node/Value/ValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,12 @@ public function __construct(
) {
}

/**
* @param mixed $value
*/
public function isValue(Expr $expr, $value): bool
public function isValue(Expr $expr, mixed $value): bool
{
return $this->getValue($expr) === $value;
}

public function getStringValue(Expr $expr): string
{
$resolvedValue = $this->getValue($expr);
if (! is_string($resolvedValue)) {
throw new ShouldNotHappenException();
}

return $resolvedValue;
}

/**
* @return mixed|null
*/
public function getValue(Expr $expr, bool $resolvedClassReference = false)
public function getValue(Expr $expr, bool $resolvedClassReference = false): mixed
{
if ($expr instanceof Concat) {
return $this->processConcat($expr, $resolvedClassReference);
Expand Down
5 changes: 1 addition & 4 deletions src/functions/node_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
use Tracy\Dumper;

if (! function_exists('dump_with_depth')) {
/**
* @param mixed $value
*/
function dump_with_depth($value, int $depth = 2): void
function dump_with_depth(mixed $value, int $depth = 2): void
{
Dumper::dump($value, [
Dumper::DEPTH => $depth,
Expand Down

0 comments on commit 76f199b

Please sign in to comment.