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

nette / php-generator / 22836119803

09 Mar 2026 02:40AM UTC coverage: 94.264% (+0.2%) from 94.029%
22836119803

push

github

dg
added CLAUDE.md

1890 of 2005 relevant lines covered (94.26%)

0.94 hits per line

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

80.0
/src/PhpGenerator/GlobalFunction.php
1
<?php declare(strict_types=1);
1✔
2

3
/**
4
 * This file is part of the Nette Framework (https://nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Nette\PhpGenerator;
9

10
use Nette;
11

12

13
/**
14
 * Definition of a global function.
15
 */
16
final class GlobalFunction
17
{
18
        use Traits\FunctionLike;
19
        use Traits\NameAware;
20
        use Traits\CommentAware;
21
        use Traits\AttributeAware;
22

23
        /**
24
         * Creates an instance from a function name or closure reflection.
25
         * @param  string|(\Closure(): mixed)  $function
26
         * @param  bool  $withBody  load function body (requires nikic/php-parser)
27
         */
28
        public static function from(string|\Closure $function, bool $withBody = false): self
1✔
29
        {
30
                return (new Factory)->fromFunctionReflection(Nette\Utils\Callback::toReflection($function), $withBody);
1✔
31
        }
32

33

34
        public function __toString(): string
35
        {
36
                return (new Printer)->printFunction($this);
1✔
37
        }
38

39

40
        public function __clone(): void
41
        {
42
                $this->parameters = array_map(fn($param) => clone $param, $this->parameters);
×
43
        }
44
}
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