Skip to content

Commit c6d49fc

Browse files
committed
Fix code style and bump to php 7.4
1 parent 1c6b546 commit c6d49fc

36 files changed

+181
-137
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.2 || ^8.0",
17+
"php": "^7.4 || ^8.0",
1818
"phpdocumentor/type-resolver": "^1.7",
1919
"webmozart/assert": "^1.9.1",
2020
"phpdocumentor/reflection-common": "^2.2",

composer.lock

Lines changed: 59 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/04-adding-your-own-tag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class MyTag extends BaseTag
4242
*
4343
* @var string
4444
*/
45-
protected $name = 'my-tag';
45+
protected string $name = 'my-tag';
4646

4747
/**
4848
* The constructor for this Tag; this should contain all properties for this object.

src/DocBlock.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@
2020
final class DocBlock
2121
{
2222
/** @var string The opening line for this docblock. */
23-
private $summary;
23+
private string $summary;
2424

2525
/** @var DocBlock\Description The actual description for this docblock. */
26-
private $description;
26+
private DocBlock\Description $description;
2727

2828
/** @var Tag[] An array containing all the tags in this docblock; except inline. */
29-
private $tags = [];
29+
private array $tags = [];
3030

3131
/** @var Types\Context|null Information about the context of this DocBlock. */
32-
private $context;
32+
private ?Types\Context $context = null;
3333

3434
/** @var Location|null Information about the location of this DocBlock. */
35-
private $location;
35+
private ?Location $location = null;
3636

3737
/** @var bool Is this DocBlock (the start of) a template? */
38-
private $isTemplateStart;
38+
private bool $isTemplateStart;
3939

4040
/** @var bool Does this DocBlock signify the end of a DocBlock template? */
41-
private $isTemplateEnd;
41+
private bool $isTemplateEnd;
4242

4343
/**
4444
* @param DocBlock\Tag[] $tags

src/DocBlock/Description.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@
5252
*/
5353
class Description
5454
{
55-
/** @var string */
56-
private $bodyTemplate;
55+
private string $bodyTemplate;
5756

5857
/** @var Tag[] */
59-
private $tags;
58+
private array $tags;
6059

6160
/**
6261
* Initializes a Description with its body (template) and a listing of the tags used in the body template.

src/DocBlock/DescriptionFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
*/
4949
class DescriptionFactory
5050
{
51-
/** @var Factory */
52-
private $tagFactory;
51+
private Factory $tagFactory;
5352

5453
/**
5554
* Initializes this factory with the means to construct (inline) tags.

src/DocBlock/ExampleFinder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131
*/
3232
class ExampleFinder
3333
{
34-
/** @var string */
35-
private $sourceDirectory = '';
34+
private string $sourceDirectory = '';
3635

3736
/** @var string[] */
38-
private $exampleDirectories = [];
37+
private array $exampleDirectories = [];
3938

4039
/**
4140
* Attempts to find the example contents for the given descriptor.

src/DocBlock/Serializer.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,20 @@
2929
class Serializer
3030
{
3131
/** @var string The string to indent the comment with. */
32-
protected $indentString = ' ';
32+
protected string $indentString = ' ';
3333

3434
/** @var int The number of times the indent string is repeated. */
35-
protected $indent = 0;
35+
protected int $indent = 0;
3636

3737
/** @var bool Whether to indent the first line with the given indent amount and string. */
38-
protected $isFirstLineIndented = true;
38+
protected bool $isFirstLineIndented = true;
3939

4040
/** @var int|null The max length of a line. */
41-
protected $lineLength;
41+
protected ?int $lineLength = null;
4242

4343
/** @var Formatter A custom tag formatter. */
44-
protected $tagFormatter;
45-
/** @var string */
46-
private $lineEnding;
44+
protected Formatter $tagFormatter;
45+
private string $lineEnding;
4746

4847
/**
4948
* Create a Serializer instance.

src/DocBlock/StandardTagFactory.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ final class StandardTagFactory implements TagFactory
7979
* @var array<class-string<Tag>|Factory> An array with a tag as a key, and an
8080
* FQCN to a class that handles it as an array value.
8181
*/
82-
private $tagHandlerMappings = [
82+
private array $tagHandlerMappings = [
8383
'author' => Author::class,
8484
'covers' => Covers::class,
8585
'deprecated' => Deprecated::class,
@@ -105,22 +105,21 @@ final class StandardTagFactory implements TagFactory
105105
* @var array<class-string<Tag>> An array with a anotation s a key, and an
106106
* FQCN to a class that handles it as an array value.
107107
*/
108-
private $annotationMappings = [];
108+
private array $annotationMappings = [];
109109

110110
/**
111111
* @var ReflectionParameter[][] a lazy-loading cache containing parameters
112112
* for each tagHandler that has been used.
113113
*/
114-
private $tagHandlerParameterCache = [];
114+
private array $tagHandlerParameterCache = [];
115115

116-
/** @var FqsenResolver */
117-
private $fqsenResolver;
116+
private FqsenResolver $fqsenResolver;
118117

119118
/**
120119
* @var mixed[] an array representing a simple Service Locator where we can store parameters and
121120
* services that can be inserted into the Factory Methods of Tag Handlers.
122121
*/
123-
private $serviceLocator = [];
122+
private array $serviceLocator = [];
124123

125124
/**
126125
* Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers.

src/DocBlock/Tags/Author.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
final class Author extends BaseTag implements Factory\StaticMethod
2828
{
2929
/** @var string register that this is the author tag. */
30-
protected $name = 'author';
30+
protected string $name = 'author';
3131

3232
/** @var string The name of the author */
33-
private $authorName;
33+
private string $authorName;
3434

3535
/** @var string The email of the author */
36-
private $authorEmail;
36+
private string $authorEmail;
3737

3838
/**
3939
* Initializes this tag with the author name and e-mail.

0 commit comments

Comments
 (0)