File: source_for_branched_exec_lines_php81.php

package info (click to toggle)
php-codecoverage 11.0.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 32,092 kB
  • sloc: php: 12,298; javascript: 10,135; xml: 1,203; makefile: 24
file content (85 lines) | stat: -rw-r--r-- 2,348 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php

// Enum
enum BasicSuit
{
    case Hearts;
    case Diamonds;
    case Clubs;
    case Spades;

    public function shape(): string
    {
        return "Rectangle";         // +1
    }
}

enum BackedSuit: string
{
    case Hearts = 'H';
    case Diamonds = 'D';
    case Clubs = 'C';
    case Spades = 'S';
}

BasicSuit::Diamonds->shape();       // +1
BackedSuit::Clubs;                  // +1


// Intersection types
interface MyIntersection
{
    public function check(MyIntOne&MyIntTwo $intersection);
    public function neverReturn(): never;
}

// New in initializers
class NewInInit_NoInit
{
    public function __construct(private DateTimeInterface $dateTime) {
    }                                                                                   // +3
    public function noinit(DateTimeInterface $dateTime) {
    }                                                                                   // +1
}
class NewInInit_OneLineNewLine
{
    public function __construct(private DateTimeInterface $dateTime = new DateTime()) {
    }                                                                                   // +1
    public function onelinenewline(DateTimeInterface $dateTime = new DateTime()) {
    }                                                                                   // +2
}
class NewInInit_OneLineSameLine
{
    public function __construct(private DateTimeInterface $dateTime = new DateTime()) {}    // +2
    public function onelinesameline(DateTimeInterface $dateTime = new DateTime()) {}    // +1
}
class NewInInit_MultiLine
{
    public function __construct(
        private
        DateTimeInterface
        $dateTime
        =
        new
        DateTime()
        ,
        private
        bool
        $var
        =
        true
    )
    {
    }                                                                                   // +1
    public function multiline(
        DateTimeInterface $dateTime = new DateTime()
    ) {
    }                                                                                   // +2
}
function newInInit_OneLineNewLine(DateTimeInterface $dateTime = new DateTime()) {
} // +2
function newInInit_OneLineSameLine(DateTimeInterface $dateTime = new DateTime()) {} // +2
function newInInit_multiline(
    DateTimeInterface $dateTime = new DateTime()
) {
} // +1