Skip to content

Commit 2457e5b

Browse files
committed
FIX naming of examples
1 parent 17ff755 commit 2457e5b

2 files changed

Lines changed: 29 additions & 8 deletions

File tree

examples/testTag/testTagOnClass.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace TestTagOnConstructor;
3+
namespace TestTagOnClass;
44

55
use DaveLiddament\PhpLanguageExtensions\TestTag;
66

@@ -11,9 +11,16 @@ public function __construct()
1111
{
1212
}
1313

14-
public static function create(): Person // No Error, class can interact with itself
14+
public static function create(): Person // OK, class can interact with itself
1515
{
16-
return new Person(); // No Error, class can interact with itself
16+
return new Person(); // OK, class can interact with itself
17+
}
18+
19+
public function aMethod(int $number): void
20+
{
21+
if ($number > 0) {
22+
$this->aMethod($number - 1); // OK, class can interact with itself
23+
}
1724
}
1825
}
1926

@@ -28,4 +35,9 @@ public function buildPerson(): Person
2835
{
2936
return Person::create(); // ERROR
3037
}
38+
39+
public function aMethod(Person $person): void
40+
{
41+
$person->aMethod(1); // ERROR
42+
}
3143
}
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace TestTagOnConstructor;
3+
namespace TestTagOnClassIgnoredInTestClass;
44

55
use DaveLiddament\PhpLanguageExtensions\TestTag;
66

@@ -11,21 +11,30 @@ public function __construct()
1111
{
1212
}
1313

14-
public static function create(): Person // No Error, class can interact with itself
14+
public static function create(): Person // OK, class can interact with itself
15+
{
16+
return new Person(); // OK, class can interact with itself
17+
}
18+
19+
public function aMethod(): void
1520
{
16-
return new Person(); // No Error, class can interact with itself
1721
}
1822
}
1923

2024
class PersonTest
2125
{
2226
public function newInstance(): Person
2327
{
24-
return new Person(); // No Error
28+
return new Person(); // OK, call from test class
2529
}
2630

2731
public function buildPerson(): Person
2832
{
29-
return Person::create(); // No error
33+
return Person::create(); // OK, call from test class
34+
}
35+
36+
public function aMethod(Person $person): void
37+
{
38+
$this->aMethod(); // OK, call from test class
3039
}
3140
}

0 commit comments

Comments
 (0)