File tree Expand file tree Collapse file tree 12 files changed +251
-65
lines changed Expand file tree Collapse file tree 12 files changed +251
-65
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,14 @@ phpcs:
19
19
phpcbf :
20
20
docker run -it --rm -v${PWD} :/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf
21
21
22
-
23
22
.PHONY : phpstan
24
23
phpstan :
25
24
docker run -it --rm -v${PWD} :/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --configuration phpstan.neon
26
25
27
- .PHONY : psaml
26
+ .PHONY : psalm
28
27
psalm :
29
28
docker run -it --rm -v${PWD} :/opt/project -w /opt/project php:7.2 tools/psalm
29
+
30
30
.PHONY : test
31
31
test :
32
32
docker run -it --rm -v${PWD} :/opt/project -w /opt/project php:7.2 tools/phpunit
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
2
<ruleset name =" phpDocumentor" >
3
- <description >The coding standard for phpDocumentor.</description >
3
+ <description >The coding standard for phpDocumentor.</description >
4
4
5
5
<file >src</file >
6
6
<file >tests/unit</file >
13
13
<rule ref =" SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix" >
14
14
<exclude-pattern >*/src/*/Abstract*.php</exclude-pattern >
15
15
</rule >
16
+
17
+ <rule ref =" PSR1.Files.SideEffects.FoundWithSymbols" >
18
+ <exclude-pattern >*/src/PseudoTypes/False_.php</exclude-pattern >
19
+ <exclude-pattern >*/src/PseudoTypes/True_.php</exclude-pattern >
20
+ </rule >
16
21
</ruleset >
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
+ /**
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 https://phpdoc.org
12
+ */
13
+
14
+ namespace phpDocumentor \Reflection \PseudoTypes ;
15
+
16
+ use phpDocumentor \Reflection \PseudoType ;
17
+ use phpDocumentor \Reflection \Type ;
18
+ use phpDocumentor \Reflection \Types \Boolean ;
19
+ use function class_alias ;
20
+
21
+ /**
22
+ * Value Object representing the PseudoType 'False', which is a Boolean type.
23
+ *
24
+ * @psalm-immutable
25
+ */
26
+ final class False_ extends Boolean implements PseudoType
27
+ {
28
+ public function underlyingType () : Type
29
+ {
30
+ return new Boolean ();
31
+ }
32
+
33
+ public function __toString () : string
34
+ {
35
+ return 'false ' ;
36
+ }
37
+ }
38
+
39
+ class_alias ('\phpDocumentor\Reflection\PseudoTypes\False_ ' , 'phpDocumentor\Reflection\Types\False_ ' , false );
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 https://phpdoc.org
12
+ */
13
+
14
+ namespace phpDocumentor \Reflection \PseudoTypes ;
15
+
16
+ use phpDocumentor \Reflection \PseudoType ;
17
+ use phpDocumentor \Reflection \Type ;
18
+ use phpDocumentor \Reflection \Types \Boolean ;
19
+ use function class_alias ;
20
+
21
+ /**
22
+ * Value Object representing the PseudoType 'False', which is a Boolean type.
23
+ *
24
+ * @psalm-immutable
25
+ */
26
+ final class True_ extends Boolean implements PseudoType
27
+ {
28
+ public function underlyingType () : Type
29
+ {
30
+ return new Boolean ();
31
+ }
32
+
33
+ public function __toString () : string
34
+ {
35
+ return 'true ' ;
36
+ }
37
+ }
38
+
39
+ class_alias ('\phpDocumentor\Reflection\PseudoTypes\True_ ' , 'phpDocumentor\Reflection\Types\True_ ' , false );
Original file line number Diff line number Diff line change @@ -87,8 +87,8 @@ final class TypeResolver
87
87
'scalar ' => Types \Scalar::class,
88
88
'callback ' => Types \Callable_::class,
89
89
'callable ' => Types \Callable_::class,
90
- 'false ' => Types \False_::class,
91
- 'true ' => Types \True_::class,
90
+ 'false ' => PseudoTypes \False_::class,
91
+ 'true ' => PseudoTypes \True_::class,
92
92
'self ' => Types \Self_::class,
93
93
'$this ' => Types \This::class,
94
94
'static ' => Types \Static_::class,
Load Diff This file was deleted.
Load Diff This file was deleted.
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\PseudoTypes\False_
21
+ */
22
+ final 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
+
44
+ /**
45
+ * @covers \phpDocumentor\Reflection\PseudoTypes\False_
46
+ */
47
+ public function testCanBeInstantiatedUsingDeprecatedFqsen () : void
48
+ {
49
+ $ false = new \phpDocumentor \Reflection \Types \False_ ();
50
+
51
+ $ this ->assertSame ('false ' , (string ) $ false );
52
+ $ this ->assertInstanceOf (False_::class, $ false );
53
+ $ this ->assertInstanceOf (\phpDocumentor \Reflection \Types \False_::class, $ false );
54
+ }
55
+ }
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\PseudoTypes\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
+
44
+ /**
45
+ * @covers \phpDocumentor\Reflection\PseudoTypes\True_
46
+ */
47
+ public function testCanBeInstantiatedUsingDeprecatedFqsen () : void
48
+ {
49
+ $ true = new \phpDocumentor \Reflection \Types \True_ ();
50
+
51
+ $ this ->assertSame ('true ' , (string ) $ true );
52
+ $ this ->assertInstanceOf (True_::class, $ true );
53
+ $ this ->assertInstanceOf (\phpDocumentor \Reflection \Types \True_::class, $ true );
54
+ }
55
+ }
Original file line number Diff line number Diff line change @@ -705,9 +705,9 @@ public function provideKeywords() : array
705
705
['bool ' , Types \Boolean::class],
706
706
['boolean ' , Types \Boolean::class],
707
707
['true ' , Types \Boolean::class],
708
- ['true ' , Types \True_::class],
708
+ ['true ' , PseudoTypes \True_::class],
709
709
['false ' , Types \Boolean::class],
710
- ['false ' , Types \False_::class],
710
+ ['false ' , PseudoTypes \False_::class],
711
711
['resource ' , Types \Resource_::class],
712
712
['null ' , Types \Null_::class],
713
713
['callable ' , Types \Callable_::class],
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 \Types ;
15
+
16
+ use PHPUnit \Framework \TestCase ;
17
+
18
+ /**
19
+ * @coversDefaultClass \phpDocumentor\Reflection\Types\Boolean
20
+ */
21
+ final class BooleanTest extends TestCase
22
+ {
23
+ /**
24
+ * @covers ::__toString
25
+ */
26
+ public function testBooleanStringifyCorrectly () : void
27
+ {
28
+ $ type = new Boolean ();
29
+
30
+ $ this ->assertSame ('bool ' , (string ) $ type );
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments