Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Psalm\Internal\TypeVisitor; use Psalm\Codebase; use Psalm\Type\Atomic; u..

Decoded Output download

<?php

namespace Psalm\Internal\TypeVisitor;

use Psalm\Codebase;
use Psalm\Type\Atomic;
use Psalm\Type\Atomic\TMixed;
use Psalm\Type\TypeNode;
use Psalm\Type\TypeVisitor;
use Psalm\Type\Union;

/** @internal */
final class CanContainObjectTypeVisitor extends TypeVisitor
{
    private bool $contains_object_type = false;

    private Codebase $codebase;

    public function __construct(Codebase $codebase)
    {
        $this->codebase = $codebase;
    }

    protected function enterNode(TypeNode $type): ?int
    {
        if (($type instanceof Union
            && ($type->hasObjectType() || $type->hasIterable() || $type->hasMixed())
        ) || ($type instanceof Atomic
            && ($type->isObjectType() || $type->isIterable($this->codebase) || $type instanceof TMixed)
        )) {
            $this->contains_object_type = true;
            return self::STOP_TRAVERSAL;
        }

        return null;
    }

    public function matches(): bool
    {
        return $this->contains_object_type;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Psalm\Internal\TypeVisitor;

use Psalm\Codebase;
use Psalm\Type\Atomic;
use Psalm\Type\Atomic\TMixed;
use Psalm\Type\TypeNode;
use Psalm\Type\TypeVisitor;
use Psalm\Type\Union;

/** @internal */
final class CanContainObjectTypeVisitor extends TypeVisitor
{
    private bool $contains_object_type = false;

    private Codebase $codebase;

    public function __construct(Codebase $codebase)
    {
        $this->codebase = $codebase;
    }

    protected function enterNode(TypeNode $type): ?int
    {
        if (($type instanceof Union
            && ($type->hasObjectType() || $type->hasIterable() || $type->hasMixed())
        ) || ($type instanceof Atomic
            && ($type->isObjectType() || $type->isIterable($this->codebase) || $type instanceof TMixed)
        )) {
            $this->contains_object_type = true;
            return self::STOP_TRAVERSAL;
        }

        return null;
    }

    public function matches(): bool
    {
        return $this->contains_object_type;
    }
}

Function Calls

None

Variables

None

Stats

MD5 ff8e771da5f95c9dcd2dc2f22577ae17
Eval Count 0
Decode Time 96 ms