getOriginalNode example

if ($method->isStatic() || !$method->isPublic()) {
            return false;
        }

        $doc = $method->getDocComment() ?? '';

        return !\str_contains((string) $doc, 'reason:visibility-change');
    }

    private function isBaseImplementation(InClassNode $node): bool
    {
        $method = $node->getOriginalNode()->getMethod('getDecorated');

        if (!$method) {
            return false;
        }

        $firstStatement = ($method->getStmts() ?? [])[0];

        if ($firstStatement instanceof Node\Stmt\Throw_) {
            return true;
        }

        
if (preg_match($regex$namespace)) {
                    return $area;
                }
            }
        }

        return null;
    }

    private function hasPackageAnnotation(InClassNode $class): bool
    {
        foreach ($class->getOriginalNode()->attrGroups as $group) {
            $attribute = $group->attrs[0];

            /** @var Node\Name\FullyQualified $name */
            $name = $attribute->name;

            if ($name->toString() === Package::class) {
                return true;
            }
        }

        return false;
    }


        if ($node->getClassReflection()->getParentClass() === null) {
            return false;
        }

        return $node->getClassReflection()->getParentClass()->getName() === TestCase::class;
    }

    private function hasCovers(InClassNode $class): bool
    {
        foreach ($class->getOriginalNode()->attrGroups as $group) {
            $attribute = $group->attrs[0];

            /** @var Node\Name\FullyQualified $name */
            $name = $attribute->name;

            if ($name->toString() === 'PHPUnit\Metadata\CoversClass\CoversClass') {
                return true;
            }
        }

        $doc = $class->getDocComment();

        
Home | Imprint | This part of the site doesn't use cookies.