File tree Expand file tree Collapse file tree 7 files changed +152
-3
lines changed Expand file tree Collapse file tree 7 files changed +152
-3
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of phpDocumentor.
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ * @link http://phpdoc.org
12
+ */
13
+
14
+ namespace phpDocumentor \Reflection ;
15
+
16
+ interface PseudoType extends Type
17
+ {
18
+ public function underlyingType (): Type ;
19
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace phpDocumentor \Reflection \PseudoTypes ;
6
+
7
+ use phpDocumentor \Reflection \PseudoType ;
8
+ use phpDocumentor \Reflection \Type ;
9
+ use phpDocumentor \Reflection \Types \Boolean ;
10
+
11
+ final class False_ extends Boolean implements PseudoType
12
+ {
13
+ public function underlyingType (): Type
14
+ {
15
+ return new Boolean ();
16
+ }
17
+
18
+ public function __toString (): string
19
+ {
20
+ return 'false ' ;
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace phpDocumentor \Reflection \PseudoTypes ;
6
+
7
+ use phpDocumentor \Reflection \PseudoType ;
8
+ use phpDocumentor \Reflection \Type ;
9
+ use phpDocumentor \Reflection \Types \Boolean ;
10
+
11
+ final class True_ extends Boolean implements PseudoType
12
+ {
13
+ public function underlyingType (): Type
14
+ {
15
+ return new Boolean ();
16
+ }
17
+
18
+ public function __toString (): string
19
+ {
20
+ return 'true ' ;
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -82,8 +82,8 @@ final class TypeResolver
82
82
'scalar ' => Types \Scalar::class,
83
83
'callback ' => Types \Callable_::class,
84
84
'callable ' => Types \Callable_::class,
85
- 'false ' => Types \Boolean ::class,
86
- 'true ' => Types \Boolean ::class,
85
+ 'false ' => PseudoTypes \False_ ::class,
86
+ 'true ' => PseudoTypes \False_ ::class,
87
87
'self ' => Types \Self_::class,
88
88
'$this ' => Types \This::class,
89
89
'static ' => Types \Static_::class,
Original file line number Diff line number Diff line change 18
18
/**
19
19
* Value Object representing a Boolean type.
20
20
*/
21
- final class Boolean implements Type
21
+ class Boolean implements Type
22
22
{
23
23
/**
24
24
* Returns a rendered output of the Type as it would be used in a DocBlock.
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of phpDocumentor.
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ * @link http://phpdoc.org
12
+ */
13
+
14
+ namespace phpDocumentor \Reflection \PseudoTypes ;
15
+
16
+ use phpDocumentor \Reflection \Types \Boolean ;
17
+ use PHPUnit \Framework \TestCase ;
18
+
19
+ /**
20
+ * @coversDefaultClass \phpDocumentor\Reflection\Types\False_
21
+ */
22
+ class FalseTest extends TestCase
23
+ {
24
+ /**
25
+ * @covers ::underlyingType
26
+ */
27
+ public function testExposesUnderlyingType () : void
28
+ {
29
+ $ false = new False_ ();
30
+
31
+ $ this ->assertInstanceOf (Boolean::class, $ false ->underlyingType ());
32
+ }
33
+
34
+ /**
35
+ * @covers ::__toString
36
+ */
37
+ public function testFalseStringifyCorrectly () : void
38
+ {
39
+ $ false = new False_ ();
40
+
41
+ $ this ->assertSame ('false ' , (string ) $ false );
42
+ }
43
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of phpDocumentor.
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ *
11
+ * @link http://phpdoc.org
12
+ */
13
+
14
+ namespace phpDocumentor \Reflection \PseudoTypes ;
15
+
16
+ use phpDocumentor \Reflection \Types \Boolean ;
17
+ use PHPUnit \Framework \TestCase ;
18
+
19
+ /**
20
+ * @coversDefaultClass \phpDocumentor\Reflection\Types\True_
21
+ */
22
+ class TrueTest extends TestCase
23
+ {
24
+ /**
25
+ * @covers ::underlyingType
26
+ */
27
+ public function testExposesUnderlyingType () : void
28
+ {
29
+ $ true = new True_ ();
30
+
31
+ $ this ->assertInstanceOf (Boolean::class, $ true ->underlyingType ());
32
+ }
33
+
34
+ /**
35
+ * @covers ::__toString
36
+ */
37
+ public function testTrueStringifyCorrectly () : void
38
+ {
39
+ $ true = new True_ ();
40
+
41
+ $ this ->assertSame ('true ' , (string ) $ true );
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments