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:
1919phpcbf :
2020 docker run -it --rm -v${PWD} :/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf
2121
22-
2322.PHONY : phpstan
2423phpstan :
2524 docker run -it --rm -v${PWD} :/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --configuration phpstan.neon
2625
27- .PHONY : psaml
26+ .PHONY : psalm
2827psalm :
2928 docker run -it --rm -v${PWD} :/opt/project -w /opt/project php:7.2 tools/psalm
29+
3030.PHONY : test
3131test :
3232 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 11<?xml version =" 1.0" ?>
22<ruleset name =" phpDocumentor" >
3- <description >The coding standard for phpDocumentor.</description >
3+ <description >The coding standard for phpDocumentor.</description >
44
55 <file >src</file >
66 <file >tests/unit</file >
1313 <rule ref =" SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix" >
1414 <exclude-pattern >*/src/*/Abstract*.php</exclude-pattern >
1515 </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 >
1621</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
8787 'scalar ' => Types \Scalar::class,
8888 'callback ' => Types \Callable_::class,
8989 'callable ' => Types \Callable_::class,
90- 'false ' => Types \False_::class,
91- 'true ' => Types \True_::class,
90+ 'false ' => PseudoTypes \False_::class,
91+ 'true ' => PseudoTypes \True_::class,
9292 'self ' => Types \Self_::class,
9393 '$this ' => Types \This::class,
9494 '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+ }
You can’t perform that action at this time.
0 commit comments