Skip to content

Commit 550e0fb

Browse files
authored
Merge pull request #112 from smoench/psalm-types
support psalm scalar types
2 parents 803c662 + 80a222c commit 550e0fb

17 files changed

+593
-9
lines changed

src/PseudoTypes/CallableString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class CallableString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'callable-string';
38+
}
39+
}

src/PseudoTypes/HtmlEscapedString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class HtmlEscapedString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'html-escaped-string';
38+
}
39+
}

src/PseudoTypes/LowercaseString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class LowercaseString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'lowercase-string';
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class NonEmptyLowercaseString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'non-empty-lowercase-string';
38+
}
39+
}

src/PseudoTypes/NonEmptyString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class NonEmptyString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'non-empty-string';
38+
}
39+
}

src/PseudoTypes/NumericString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class NumericString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'numeric-string';
38+
}
39+
}

src/PseudoTypes/PositiveInteger.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\Integer;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class PositiveInteger extends Integer implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new Integer();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'positive-int';
38+
}
39+
}

src/PseudoTypes/TraitString.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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\PseudoType;
17+
use phpDocumentor\Reflection\Type;
18+
use phpDocumentor\Reflection\Types\String_;
19+
20+
/**
21+
* Value Object representing the type 'string'.
22+
*
23+
* @psalm-immutable
24+
*/
25+
final class TraitString extends String_ implements PseudoType
26+
{
27+
public function underlyingType() : Type
28+
{
29+
return new String_();
30+
}
31+
32+
/**
33+
* Returns a rendered output of the Type as it would be used in a DocBlock.
34+
*/
35+
public function __toString() : string
36+
{
37+
return 'trait-string';
38+
}
39+
}

0 commit comments

Comments
 (0)