Fix code style and bump to php 7.4

This commit is contained in:
Jaapio
2024-03-12 22:28:53 +01:00
parent 1c6b5465fa
commit c6d49fc451
36 changed files with 181 additions and 137 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
} }
], ],
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.4 || ^8.0",
"phpdocumentor/type-resolver": "^1.7", "phpdocumentor/type-resolver": "^1.7",
"webmozart/assert": "^1.9.1", "webmozart/assert": "^1.9.1",
"phpdocumentor/reflection-common": "^2.2", "phpdocumentor/reflection-common": "^2.2",
Generated
+59 -14
View File
@@ -4,8 +4,55 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "829061026cc6b2284953cbe816406760", "content-hash": "e85fae7945bde2c4a84d94d4ca572202",
"packages": [ "packages": [
{
"name": "doctrine/deprecations",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
"reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpstan/phpstan": "1.4.10 || 1.10.15",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "0.18.4",
"psr/log": "^1 || ^2 || ^3",
"vimeo/psalm": "4.30.0 || 5.12.0"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/1.1.3"
},
"time": "2024-01-30T19:34:25+00:00"
},
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
"version": "2.2.0", "version": "2.2.0",
@@ -61,20 +108,21 @@
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
"version": "1.x-dev", "version": "1.8.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git", "url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2dc9aff0e6ca4e4600355c68c4a38bfaeccf54e2" "reference": "153ae662783729388a584b4361f2545e4d841e3c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2dc9aff0e6ca4e4600355c68c4a38bfaeccf54e2", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c",
"reference": "2dc9aff0e6ca4e4600355c68c4a38bfaeccf54e2", "reference": "153ae662783729388a584b4361f2545e4d841e3c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.4 || ^8.0", "doctrine/deprecations": "^1.0",
"php": "^7.3 || ^8.0",
"phpdocumentor/reflection-common": "^2.0", "phpdocumentor/reflection-common": "^2.0",
"phpstan/phpdoc-parser": "^1.13" "phpstan/phpdoc-parser": "^1.13"
}, },
@@ -88,7 +136,6 @@
"rector/rector": "^0.13.9", "rector/rector": "^0.13.9",
"vimeo/psalm": "^4.25" "vimeo/psalm": "^4.25"
}, },
"default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@@ -113,9 +160,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": { "support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues", "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2"
}, },
"time": "2022-11-19T20:09:31+00:00" "time": "2024-02-23T11:10:43+00:00"
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
@@ -4057,18 +4104,16 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": [],
"phpdocumentor/type-resolver": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.2 || ^8.0", "php": "^7.4 || ^8.0",
"ext-filter": "*" "ext-filter": "*"
}, },
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.4.0" "php": "7.4.0"
}, },
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }
+1 -1
View File
@@ -42,7 +42,7 @@ final class MyTag extends BaseTag
* *
* @var string * @var string
*/ */
protected $name = 'my-tag'; protected string $name = 'my-tag';
/** /**
* The constructor for this Tag; this should contain all properties for this object. * The constructor for this Tag; this should contain all properties for this object.
+7 -7
View File
@@ -20,25 +20,25 @@ use Webmozart\Assert\Assert;
final class DocBlock final class DocBlock
{ {
/** @var string The opening line for this docblock. */ /** @var string The opening line for this docblock. */
private $summary; private string $summary;
/** @var DocBlock\Description The actual description for this docblock. */ /** @var DocBlock\Description The actual description for this docblock. */
private $description; private DocBlock\Description $description;
/** @var Tag[] An array containing all the tags in this docblock; except inline. */ /** @var Tag[] An array containing all the tags in this docblock; except inline. */
private $tags = []; private array $tags = [];
/** @var Types\Context|null Information about the context of this DocBlock. */ /** @var Types\Context|null Information about the context of this DocBlock. */
private $context; private ?Types\Context $context = null;
/** @var Location|null Information about the location of this DocBlock. */ /** @var Location|null Information about the location of this DocBlock. */
private $location; private ?Location $location = null;
/** @var bool Is this DocBlock (the start of) a template? */ /** @var bool Is this DocBlock (the start of) a template? */
private $isTemplateStart; private bool $isTemplateStart;
/** @var bool Does this DocBlock signify the end of a DocBlock template? */ /** @var bool Does this DocBlock signify the end of a DocBlock template? */
private $isTemplateEnd; private bool $isTemplateEnd;
/** /**
* @param DocBlock\Tag[] $tags * @param DocBlock\Tag[] $tags
+2 -3
View File
@@ -52,11 +52,10 @@ use function vsprintf;
*/ */
class Description class Description
{ {
/** @var string */ private string $bodyTemplate;
private $bodyTemplate;
/** @var Tag[] */ /** @var Tag[] */
private $tags; private array $tags;
/** /**
* Initializes a Description with its body (template) and a listing of the tags used in the body template. * Initializes a Description with its body (template) and a listing of the tags used in the body template.
+1 -2
View File
@@ -48,8 +48,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
class DescriptionFactory class DescriptionFactory
{ {
/** @var Factory */ private Factory $tagFactory;
private $tagFactory;
/** /**
* Initializes this factory with the means to construct (inline) tags. * Initializes this factory with the means to construct (inline) tags.
+2 -3
View File
@@ -31,11 +31,10 @@ use const DIRECTORY_SEPARATOR;
*/ */
class ExampleFinder class ExampleFinder
{ {
/** @var string */ private string $sourceDirectory = '';
private $sourceDirectory = '';
/** @var string[] */ /** @var string[] */
private $exampleDirectories = []; private array $exampleDirectories = [];
/** /**
* Attempts to find the example contents for the given descriptor. * Attempts to find the example contents for the given descriptor.
+6 -7
View File
@@ -29,21 +29,20 @@ use function wordwrap;
class Serializer class Serializer
{ {
/** @var string The string to indent the comment with. */ /** @var string The string to indent the comment with. */
protected $indentString = ' '; protected string $indentString = ' ';
/** @var int The number of times the indent string is repeated. */ /** @var int The number of times the indent string is repeated. */
protected $indent = 0; protected int $indent = 0;
/** @var bool Whether to indent the first line with the given indent amount and string. */ /** @var bool Whether to indent the first line with the given indent amount and string. */
protected $isFirstLineIndented = true; protected bool $isFirstLineIndented = true;
/** @var int|null The max length of a line. */ /** @var int|null The max length of a line. */
protected $lineLength; protected ?int $lineLength = null;
/** @var Formatter A custom tag formatter. */ /** @var Formatter A custom tag formatter. */
protected $tagFormatter; protected Formatter $tagFormatter;
/** @var string */ private string $lineEnding;
private $lineEnding;
/** /**
* Create a Serializer instance. * Create a Serializer instance.
+5 -6
View File
@@ -79,7 +79,7 @@ final class StandardTagFactory implements TagFactory
* @var array<class-string<Tag>|Factory> An array with a tag as a key, and an * @var array<class-string<Tag>|Factory> An array with a tag as a key, and an
* FQCN to a class that handles it as an array value. * FQCN to a class that handles it as an array value.
*/ */
private $tagHandlerMappings = [ private array $tagHandlerMappings = [
'author' => Author::class, 'author' => Author::class,
'covers' => Covers::class, 'covers' => Covers::class,
'deprecated' => Deprecated::class, 'deprecated' => Deprecated::class,
@@ -105,22 +105,21 @@ final class StandardTagFactory implements TagFactory
* @var array<class-string<Tag>> An array with a anotation s a key, and an * @var array<class-string<Tag>> An array with a anotation s a key, and an
* FQCN to a class that handles it as an array value. * FQCN to a class that handles it as an array value.
*/ */
private $annotationMappings = []; private array $annotationMappings = [];
/** /**
* @var ReflectionParameter[][] a lazy-loading cache containing parameters * @var ReflectionParameter[][] a lazy-loading cache containing parameters
* for each tagHandler that has been used. * for each tagHandler that has been used.
*/ */
private $tagHandlerParameterCache = []; private array $tagHandlerParameterCache = [];
/** @var FqsenResolver */ private FqsenResolver $fqsenResolver;
private $fqsenResolver;
/** /**
* @var mixed[] an array representing a simple Service Locator where we can store parameters and * @var mixed[] an array representing a simple Service Locator where we can store parameters and
* services that can be inserted into the Factory Methods of Tag Handlers. * services that can be inserted into the Factory Methods of Tag Handlers.
*/ */
private $serviceLocator = []; private array $serviceLocator = [];
/** /**
* Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers. * Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers.
+3 -3
View File
@@ -27,13 +27,13 @@ use const FILTER_VALIDATE_EMAIL;
final class Author extends BaseTag implements Factory\StaticMethod final class Author extends BaseTag implements Factory\StaticMethod
{ {
/** @var string register that this is the author tag. */ /** @var string register that this is the author tag. */
protected $name = 'author'; protected string $name = 'author';
/** @var string The name of the author */ /** @var string The name of the author */
private $authorName; private string $authorName;
/** @var string The email of the author */ /** @var string The email of the author */
private $authorEmail; private string $authorEmail;
/** /**
* Initializes this tag with the author name and e-mail. * Initializes this tag with the author name and e-mail.
+2 -2
View File
@@ -22,10 +22,10 @@ use phpDocumentor\Reflection\DocBlock\Description;
abstract class BaseTag implements DocBlock\Tag abstract class BaseTag implements DocBlock\Tag
{ {
/** @var string Name of the tag */ /** @var string Name of the tag */
protected $name = ''; protected string $name = '';
/** @var Description|null Description of the tag. */ /** @var Description|null Description of the tag. */
protected $description; protected ?Description $description = null;
/** /**
* Gets the name of this tag. * Gets the name of this tag.
+2 -4
View File
@@ -29,11 +29,9 @@ use function explode;
*/ */
final class Covers extends BaseTag implements Factory\StaticMethod final class Covers extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'covers';
protected $name = 'covers';
/** @var Fqsen */ private Fqsen $refers;
private $refers;
/** /**
* Initializes this tag. * Initializes this tag.
+2 -3
View File
@@ -25,8 +25,7 @@ use function preg_match;
*/ */
final class Deprecated extends BaseTag implements Factory\StaticMethod final class Deprecated extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'deprecated';
protected $name = 'deprecated';
/** /**
* PCRE regular expression matching a version vector. * PCRE regular expression matching a version vector.
@@ -45,7 +44,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
)'; )';
/** @var string|null The version vector. */ /** @var string|null The version vector. */
private $version; private ?string $version = null;
public function __construct(?string $version = null, ?Description $description = null) public function __construct(?string $version = null, ?Description $description = null)
{ {
+5 -8
View File
@@ -29,22 +29,19 @@ use function trim;
final class Example implements Tag, Factory\StaticMethod final class Example implements Tag, Factory\StaticMethod
{ {
/** @var string Path to a file to use as an example. May also be an absolute URI. */ /** @var string Path to a file to use as an example. May also be an absolute URI. */
private $filePath; private string $filePath;
/** /**
* @var bool Whether the file path component represents an URI. This determines how the file portion * @var bool Whether the file path component represents an URI. This determines how the file portion
* appears at {@link getContent()}. * appears at {@link getContent()}.
*/ */
private $isURI; private bool $isURI;
/** @var int */ private int $startingLine;
private $startingLine;
/** @var int */ private int $lineCount;
private $lineCount;
/** @var string|null */ private ?string $content = null;
private $content;
public function __construct( public function __construct(
string $filePath, string $filePath,
@@ -23,7 +23,7 @@ use function strlen;
class AlignFormatter implements Formatter class AlignFormatter implements Formatter
{ {
/** @var int The maximum tag name length. */ /** @var int The maximum tag name length. */
protected $maxLen = 0; protected int $maxLen = 0;
/** /**
* @param Tag[] $tags All tags that should later be aligned with the formatter. * @param Tag[] $tags All tags that should later be aligned with the formatter.
+3 -6
View File
@@ -32,14 +32,11 @@ use function sprintf;
*/ */
final class InvalidTag implements Tag final class InvalidTag implements Tag
{ {
/** @var string */ private string $name;
private $name;
/** @var string */ private string $body;
private $body;
/** @var Throwable|null */ private ?Throwable $throwable = null;
private $throwable;
private function __construct(string $name, string $body) private function __construct(string $name, string $body)
{ {
+2 -4
View File
@@ -24,11 +24,9 @@ use Webmozart\Assert\Assert;
*/ */
final class Link extends BaseTag implements Factory\StaticMethod final class Link extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'link';
protected $name = 'link';
/** @var string */ private string $link;
private $link;
/** /**
* Initializes a link to a URL. * Initializes a link to a URL.
+5 -10
View File
@@ -43,20 +43,15 @@ use const E_USER_DEPRECATED;
*/ */
final class Method extends BaseTag implements Factory\StaticMethod final class Method extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'method';
protected $name = 'method';
/** @var string */ private string $methodName;
private $methodName;
/** @var bool */ private bool $isStatic;
private $isStatic;
/** @var Type */ private Type $returnType;
private $returnType;
/** @var bool */ private bool $returnsReference;
private $returnsReference;
/** @var MethodParameter[] */ /** @var MethodParameter[] */
private array $parameters; private array $parameters;
+5 -10
View File
@@ -16,20 +16,15 @@ use phpDocumentor\Reflection\Type;
final class MethodParameter final class MethodParameter
{ {
/** @var Type */ private Type $type;
private $type;
/** @var bool */ private bool $isReference;
private $isReference;
/** @var bool */ private bool $isVariadic;
private $isVariadic;
/** @var string */ private string $name;
private $name;
/** @var string|null */ private ?string $defaultValue = null;
private $defaultValue;
public function __construct( public function __construct(
string $name, string $name,
+3 -4
View File
@@ -36,14 +36,13 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
final class Param extends TagWithType implements Factory\StaticMethod final class Param extends TagWithType implements Factory\StaticMethod
{ {
/** @var string|null */ private ?string $variableName = null;
private $variableName;
/** @var bool determines whether this is a variadic argument */ /** @var bool determines whether this is a variadic argument */
private $isVariadic; private bool $isVariadic;
/** @var bool determines whether this is passed by reference */ /** @var bool determines whether this is passed by reference */
private $isReference; private bool $isReference;
public function __construct( public function __construct(
?string $variableName, ?string $variableName,
+1 -2
View File
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
final class Property extends TagWithType implements Factory\StaticMethod final class Property extends TagWithType implements Factory\StaticMethod
{ {
/** @var string|null */ protected ?string $variableName = null;
protected $variableName;
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
{ {
+1 -2
View File
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
final class PropertyRead extends TagWithType implements Factory\StaticMethod final class PropertyRead extends TagWithType implements Factory\StaticMethod
{ {
/** @var string|null */ protected ?string $variableName = null;
protected $variableName;
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
{ {
+1 -2
View File
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
final class PropertyWrite extends TagWithType implements Factory\StaticMethod final class PropertyWrite extends TagWithType implements Factory\StaticMethod
{ {
/** @var string */ protected string $variableName;
protected $variableName;
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
{ {
+1 -2
View File
@@ -20,8 +20,7 @@ use phpDocumentor\Reflection\Fqsen as RealFqsen;
*/ */
final class Fqsen implements Reference final class Fqsen implements Reference
{ {
/** @var RealFqsen */ private RealFqsen $fqsen;
private $fqsen;
public function __construct(RealFqsen $fqsen) public function __construct(RealFqsen $fqsen)
{ {
+1 -2
View File
@@ -20,8 +20,7 @@ use Webmozart\Assert\Assert;
*/ */
final class Url implements Reference final class Url implements Reference
{ {
/** @var string */ private string $uri;
private $uri;
public function __construct(string $uri) public function __construct(string $uri)
{ {
+2 -4
View File
@@ -33,11 +33,9 @@ use function preg_match;
*/ */
final class See extends BaseTag implements Factory\StaticMethod final class See extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'see';
protected $name = 'see';
/** @var Reference */ protected Reference $refers;
protected $refers;
/** /**
* Initializes this tag. * Initializes this tag.
+2 -3
View File
@@ -25,8 +25,7 @@ use function preg_match;
*/ */
final class Since extends BaseTag implements Factory\StaticMethod final class Since extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'since';
protected $name = 'since';
/** /**
* PCRE regular expression matching a version vector. * PCRE regular expression matching a version vector.
@@ -45,7 +44,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
)'; )';
/** @var string|null The version vector. */ /** @var string|null The version vector. */
private $version; private ?string $version = null;
public function __construct(?string $version = null, ?Description $description = null) public function __construct(?string $version = null, ?Description $description = null)
{ {
+3 -4
View File
@@ -25,14 +25,13 @@ use function preg_match;
*/ */
final class Source extends BaseTag implements Factory\StaticMethod final class Source extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'source';
protected $name = 'source';
/** @var int The starting line, relative to the structural element's location. */ /** @var int The starting line, relative to the structural element's location. */
private $startingLine; private int $startingLine;
/** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */
private $lineCount; private ?int $lineCount = null;
/** /**
* @param int|string $startingLine should be a to int convertible value * @param int|string $startingLine should be a to int convertible value
+1 -1
View File
@@ -23,7 +23,7 @@ use function trim;
abstract class TagWithType extends BaseTag abstract class TagWithType extends BaseTag
{ {
/** @var ?Type */ /** @var ?Type */
protected $type; protected ?Type $type = null;
/** /**
* Returns the type section of the variable. * Returns the type section of the variable.
+2 -4
View File
@@ -29,11 +29,9 @@ use function explode;
*/ */
final class Uses extends BaseTag implements Factory\StaticMethod final class Uses extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'uses';
protected $name = 'uses';
/** @var Fqsen */ protected Fqsen $refers;
protected $refers;
/** /**
* Initializes this tag. * Initializes this tag.
+1 -2
View File
@@ -36,8 +36,7 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
final class Var_ extends TagWithType implements Factory\StaticMethod final class Var_ extends TagWithType implements Factory\StaticMethod
{ {
/** @var string|null */ protected ?string $variableName = '';
protected $variableName = '';
public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null)
{ {
+2 -3
View File
@@ -25,8 +25,7 @@ use function preg_match;
*/ */
final class Version extends BaseTag implements Factory\StaticMethod final class Version extends BaseTag implements Factory\StaticMethod
{ {
/** @var string */ protected string $name = 'version';
protected $name = 'version';
/** /**
* PCRE regular expression matching a version vector. * PCRE regular expression matching a version vector.
@@ -45,7 +44,7 @@ final class Version extends BaseTag implements Factory\StaticMethod
)'; )';
/** @var string|null The version vector. */ /** @var string|null The version vector. */
private $version; private ?string $version = null;
public function __construct(?string $version = null, ?Description $description = null) public function __construct(?string $version = null, ?Description $description = null)
{ {
+2 -4
View File
@@ -44,11 +44,9 @@ use function trim;
final class DocBlockFactory implements DocBlockFactoryInterface final class DocBlockFactory implements DocBlockFactoryInterface
{ {
/** @var DocBlock\DescriptionFactory */ private DocBlock\DescriptionFactory $descriptionFactory;
private $descriptionFactory;
/** @var TagFactory */ private TagFactory $tagFactory;
private $tagFactory;
/** /**
* Initializes this factory with the required subcontractors. * Initializes this factory with the required subcontractors.
@@ -14,6 +14,9 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection; namespace phpDocumentor\Reflection;
use Mockery as m; use Mockery as m;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
use phpDocumentor\Reflection\Types\ContextFactory;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
/** /**
@@ -40,4 +43,43 @@ class ReconstitutingADocBlockTest extends TestCase
$this->assertSame($docComment, $reconstitutedDocComment); $this->assertSame($docComment, $reconstitutedDocComment);
} }
/**
* Method
*
* Method which contains a modulo sign (%) in its description.
*
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
*
* @covers ::__construct
* @covers ::render
* @covers ::__toString
*/
public function testDescriptionCanContainPercent(): void
{
$factory = DocBlockFactory::createInstance();
$contextFactory = new ContextFactory();
$method = new \ReflectionMethod(self::class, 'testDescriptionCanContainPercent');
$docblock = $factory->create(
$method,
$contextFactory->createFromReflector($method->getDeclaringClass())
);
$tag1 = new Generic('JoinColumn', new Description('(name="column_id", referencedColumnName="id")'));
$tag2 = new Generic('JoinColumn', new Description('(name="column_id_2", referencedColumnName="id")'));
$tags = [
$tag1,
$tag2,
];
$fixture = $docblock->getDescription();
$expected = 'Method which contains a modulo sign (%) in its description.';
$this->assertSame($expected, (string) $fixture);
}
} }
+1 -1
View File
@@ -165,7 +165,7 @@ class DescriptionTest extends TestCase
{% endfor %}'; {% endfor %}';
EOT; EOT;
$fixture = new Description($body, []); $fixture = new Description($body, []);
$this->assertSame($expected, (string) $fixture); $this->assertSame($expected, (string) $fixture);
} }
+1 -2
View File
@@ -14,8 +14,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ExampleFinderTest extends TestCase class ExampleFinderTest extends TestCase
{ {
/** @var ExampleFinder */ private ExampleFinder $fixture;
private $fixture;
/** /**
* Call Mockery::close after each test. * Call Mockery::close after each test.