• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nikic / PHP-Parser / 20190813770

13 Dec 2025 10:32AM UTC coverage: 92.543% (-0.01%) from 92.553%
20190813770

Pull #1136

github

web-flow
Merge 9f808ee1d into 8c360e273
Pull Request #1136: Do not try to re-clone already has origNode on CloningVisitor

1 of 2 new or added lines in 1 file covered. (50.0%)

7707 of 8328 relevant lines covered (92.54%)

227.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/lib/PhpParser/NodeVisitor/CloningVisitor.php
1
<?php declare(strict_types=1);
2

3
namespace PhpParser\NodeVisitor;
4

5
use PhpParser\Node;
6
use PhpParser\NodeVisitorAbstract;
7

8
/**
9
 * Visitor cloning all nodes and linking to the original nodes using an attribute.
10
 *
11
 * This visitor is required to perform format-preserving pretty prints.
12
 */
13
class CloningVisitor extends NodeVisitorAbstract {
14
    public function enterNode(Node $origNode) {
15
        if ($origNode->hasAttribute('origNode')) {
396✔
NEW
16
            return null;
×
17
        }
18

19
        $node = clone $origNode;
396✔
20
        $node->setAttribute('origNode', $origNode);
396✔
21
        return $node;
396✔
22
    }
23
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc