• 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

95.65
/src/PhpGenerator/Parameter.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\Utils\Type;
11

12

13
/**
14
 * Definition of a function/method parameter.
15
 */
16
class Parameter
17
{
18
        use Traits\NameAware;
19
        use Traits\AttributeAware;
20
        use Traits\CommentAware;
21

22
        private bool $reference = false;
23
        private ?string $type = null;
24
        private bool $nullable = false;
25
        private bool $hasDefaultValue = false;
26
        private mixed $defaultValue = null;
27

28

29
        public function setReference(bool $state = true): static
1✔
30
        {
31
                $this->reference = $state;
1✔
32
                return $this;
1✔
33
        }
34

35

36
        public function isReference(): bool
37
        {
38
                return $this->reference;
1✔
39
        }
40

41

42
        public function setType(?string $type): static
1✔
43
        {
44
                $this->type = Helpers::validateType($type, $this->nullable);
1✔
45
                return $this;
1✔
46
        }
47

48

49
        /** @return ($asObject is true ? ?Type : ?string) */
50
        public function getType(bool $asObject = false): Type|string|null
1✔
51
        {
52
                return $asObject && $this->type
1✔
53
                        ? Type::fromString($this->type)
×
54
                        : $this->type;
1✔
55
        }
56

57

58
        public function setNullable(bool $state = true): static
1✔
59
        {
60
                $this->nullable = $state;
1✔
61
                return $this;
1✔
62
        }
63

64

65
        public function isNullable(): bool
66
        {
67
                return $this->nullable || ($this->hasDefaultValue && $this->defaultValue === null);
1✔
68
        }
69

70

71
        public function setDefaultValue(mixed $val): static
1✔
72
        {
73
                $this->defaultValue = $val;
1✔
74
                $this->hasDefaultValue = true;
1✔
75
                return $this;
1✔
76
        }
77

78

79
        public function getDefaultValue(): mixed
80
        {
81
                return $this->defaultValue;
1✔
82
        }
83

84

85
        public function hasDefaultValue(): bool
86
        {
87
                return $this->hasDefaultValue;
1✔
88
        }
89

90

91
        public function validate(): void
92
        {
93
        }
1✔
94
}
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